55件ヒット
[1-55件を表示]
(0.058秒)
種類
- インスタンスメソッド (44)
- クラス (11)
検索結果
先頭5件
-
Complex
# to _ c -> self (18230.0) -
self を返します。
...
self を返します。
//emlist[例][ruby]{
Complex(2).to_c # => (2+0i)
Complex(-8, 6).to_c # => (-8+6i)
//}... -
Numeric
# to _ c -> Complex (18141.0) -
自身を複素数 (Complex) に変換します。Complex(self, 0) を返します。
...自身を複素数 (Complex) に変換します。Complex(self, 0) を返します。
//emlist[例][ruby]{
1.to_c # => (1+0i)
-1.to_c # => (-1+0i)
1.0.to_c # => (1.0+0i)
Rational(1, 2).to_c # => ((1/2)+0i)
//}
Numeric のサブクラスは、このメソッド... -
Array
# to _ csv(**options) -> String (6116.0) -
CSV.generate_line(self, options) と同様です。
...CSV.generate_line(self, options) と同様です。
Array オブジェクトを 1 行の CSV 文字列に変換するためのショートカットです。
@param options CSV.generate_line と同様のオプションを指定します。
//emlist[][ruby]{
require 'csv'
p [1, 'Matz', :Ruby, Dat......e.new(1965, 4, 14)].to_csv # => "1,Matz,Ruby,1965-04-14\n"
p [1, 'Matz', :Ruby, Date.new(1965, 4, 14)].to_csv(col_sep: ' ', row_sep: "\r\n") # => "1 Matz Ruby 1965-04-14\r\n"
//}
@see CSV.generate_line......e.new(1965, 4, 14)].to_csv # => "1,Matz,Ruby,1965-04-14\n"
p [1, 'Matz', :Ruby, Date.new(1965, 4, 14)].to_csv(col_sep: ' ', row_sep: "\r\n") # => "1 Matz Ruby 1965-04-14\r\n"
//}
Ruby 3.0 (CSV 3.1.9) から、次のオプションが使えるようになりました......。
//emlist[][ruby]{
require 'csv'
puts [1, nil].to_csv # => 1,
puts [1, nil].to_csv(write_nil_value: "N/A") # => 1,N/A
puts [2, ""].to_csv # => 2,""
puts [2, ""].to_csv(write_empty_value: "BLANK") # => 2,BLANK
//}
@see CSV.generate_l... -
Matrix
# minor(from _ row . . to _ row , from _ col . . to _ col) -> Matrix (116.0) -
selfの部分行列を返します。
...
selfの部分行列を返します。
自分自身の部分行列を返します。
ただし、パラメータは次の方法で指定します。
(1) 開始行番号, 行の大きさ, 開始列番号, 列の大きさ
(2) 開始行番号..終了行番号, 開始列番号..終了列番号
@pa... -
Numeric (60.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...- - - -
times | - o - - - - -
to_c | o - - - - - o
to_f | - - o......**d
if self > 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end
end
def rounddown(d=0)
x = 10**d
if self < 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end
end
def roundoff(d=0)
x = 10**d
if self < 0
(self.quo(x) -......0.5).ceil * x
else
(self.quo(x) + 0.5).floor * x
end
end
end
//}......succ | - o - - -
times | - o - - -
to_c | o - - - o
to_f | - o o o o...