156件ヒット
[101-156件を表示]
(0.064秒)
種類
- インスタンスメソッド (132)
- クラス (24)
クラス
- Array (12)
-
CSV
:: Row (24) -
CSV
:: Table (24) - Complex (12)
- Matrix (12)
- NilClass (12)
- Numeric (12)
- String (12)
- UnboundMethod (12)
検索結果
先頭5件
-
CSV
:: Table # to _ s(options = Hash . new) -> String (3006.0) -
CSV の文字列に変換して返します。
...ションに :write_headers =>
false を指定するとヘッダを出力しません。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_headers: false) # => "1,2,3\n"
//}... -
Matrix
# minor(from _ row . . to _ row , from _ col . . to _ col) -> Matrix (106.0) -
selfの部分行列を返します。
...行列の行サイズ
@param from_col 部分行列の開始列(0オリジンで指定)
@param col_size 部分行列の列サイズ
//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3, 4, 5]
a2 = [11, 12, 13, 14, 15]
a3 = [21, 22, 23, 24, 25]
a4 = [31, 32, 33, 34, 35]
a5 = [51, 52, 53, 54, 55]... -
Complex (54.0)
-
複素数を扱うクラスです。
...ジェクトを作成するには、Kernel.#Complex、
Complex.rect、Complex.polar、Numeric#to_c、
String#to_c のいずれかを使用します。
//emlist[Complex オブジェクトの作り方][ruby]{
Complex(1) # => (1+0i)
Complex(2, 3) # => (2+3i)
Complex.polar(2, 3) # =>......i)
Complex('1@2') # => (-0.4161468365471424+0.9092974268256817i)
3.to_c # => (3+0i)
0.3.to_c # => (0.3+0i)
'0.3-0.5i'.to_c # => (0.3-0.5i)
'2/3+3/4i'.to_c # => ((2/3)+(3/4)*i)
'1@2'.to_c # => (-0.4161468365471424+0.9092974268256817i)
//}
Complex......オブジェクトは有理数の形式も実数の形式も扱う事ができます。
//emlist[例][ruby]{
Complex(1, 1) / 2 # => ((1/2)+(1/2)*i)
Complex(1, 1) / 2.0 # => (0.5+0.5i)
//}... -
Numeric (48.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...覧です。実際にどのメソッドがどのクラスに定義されているかはそれぞ
れのクラスを参照してください。
=> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Numeric Integer Fixnum Bignum Float Rational C......- - - -
times | - o - - - - -
to_c | o - - - - - o
to_f | - - o......下のように定義できます。
//emlist[例][ruby]{
if n > 0 then
n.ceil
else
n.floor
end
//}
また、任意桁の切上げ、切捨て、四捨五入を行うメソッドは以下のように
定義できます。
//emlist[][ruby]{
class Numeric
def roundup(d=0)
x = 10**d
if......覧です。実際にどのメソッドがどのクラスに定義されているかはそれぞ
れのクラスを参照してください。
=> ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
Numeric Integer Float Rational Complex
-------......succ | - o - - -
times | - o - - -
to_c | o - - - o
to_f | - o o o o... -
UnboundMethod
# owner -> Class | Module (12.0) -
このメソッドが定義されている class か module を返します。
...このメソッドが定義されている class か module を返します。
//emlist[例][ruby]{
Integer.instance_method(:to_s).owner # => Integer
Integer.instance_method(:to_c).owner # => Numeric
Integer.instance_method(:hash).owner # => Kernel
//}...