ライブラリ
- ビルトイン (1998)
クラス
- Array (646)
- Complex (12)
- Data (6)
- Enumerator (12)
- File (18)
- Float (21)
- Integer (40)
- Module (72)
- Object (24)
- Range (218)
- Rational (60)
- Regexp (12)
- String (12)
- SystemCallError (36)
- UnboundMethod (12)
モジュール
- Enumerable (144)
- Kernel (175)
- Marshal (72)
- Math (324)
- ObjectSpace (12)
キーワード
-
$ @ (12) -
$ SAFE (7) -
$ ~ (12) - & (12)
- * (24)
- ** (12)
- + (12)
- - (12)
- < (12)
- <= (12)
- =~ (24)
- > (12)
- >= (12)
- ArgumentError (12)
- Array (12)
- Float (12)
- Hash (12)
- Integer (24)
-
MAJOR
_ VERSION (12) -
MINOR
_ VERSION (12) - String (12)
- TypeError (12)
- [] (36)
- []= (36)
-
absolute
_ path? (6) - acos (12)
- acosh (12)
- asin (12)
- asinh (12)
- at (12)
- atan (12)
- atan2 (12)
- atanh (12)
- begin (12)
- bind (12)
- bsearch (48)
- cbrt (12)
- ceil (12)
- coerce (12)
- combination (24)
- cos (12)
- cosh (12)
-
count
_ objects (12) - cycle (24)
- define (6)
-
define
_ method (48) -
delete
_ at (12) - dig (10)
- dump (24)
- dup (4)
- each (24)
- end (12)
- erf (12)
- erfc (12)
- exp (12)
- fail (36)
- feed (12)
- fetch (36)
- first (48)
- flatten (12)
- flatten! (12)
- floor (12)
- freeze (6)
- frexp (12)
- gamma (12)
- hypot (12)
-
initialize
_ copy (12) - insert (12)
- intersection (6)
- join (24)
- last (48)
- ldexp (12)
- lgamma (12)
- load (12)
- log (24)
- log10 (12)
- log2 (12)
- max (94)
- min (94)
- new (36)
- overlap? (2)
- permutation (24)
- pop (24)
- pow (24)
- putc (12)
- raise (36)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - replace (12)
- restore (12)
-
reverse
_ each (4) - rotate (12)
- rotate! (12)
- round (33)
- sample (48)
- shift (24)
- sin (12)
-
singleton
_ class (12) - sinh (12)
- sort (24)
- sqrt (12)
- sum (42)
- tan (12)
- tanh (12)
-
to
_ i (12) - transpose (12)
- truncate (12)
-
try
_ convert (4) - zip (24)
- | (12)
検索結果
先頭5件
-
TypeError (14000.0)
-
メソッドの引数に期待される型ではないオブジェクトや、期待される振る舞いを持たないオブジェクトが渡された時に発生します。
メソッドの引数に期待される型ではないオブジェクトや、期待される振る舞いを持たないオブジェクトが渡された時に発生します。
@see ArgumentError -
Kernel
. # Integer(arg , base = 0) -> Integer (8024.0) -
引数を整数 (Fixnum,Bignum) に変換した結果を返します。
...した場合に発生します。
@raise TypeError メソッド to_int, to_i を持たないオブジェクトを引数に指定したか、to_int, to_i
が整数(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発......ger(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)
p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010")... -
Kernel
. # Integer(arg , base = 0 , exception: true) -> Integer | nil (8024.0) -
引数を整数 に変換した結果を返します。
...した場合に発生します。
@raise TypeError メソッド to_int, to_i を持たないオブジェクトを引数に指定したか、to_int, to_i
が整数(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発......ger(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)
p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010")... -
Kernel
. # Float(arg) -> Float (8018.0) -
引数を浮動小数点数(Float)に変換した結果を返します。
...です。
@raise ArgumentError 整数や浮動小数点数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError nil またはメソッド to_f を持たないオブジェクトを引数に指定したか、
to_f が浮動小数点数を返......#=> 9.88
p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)
p Float("10") #=> 10.0
p Float("10e2") #=> 1000.0
p Float("1e-2") #=> 0.01
p Float(".1")... -
Kernel
. # Float(arg , exception: true) -> Float | nil (8018.0) -
引数を浮動小数点数(Float)に変換した結果を返します。
...ます。
@raise ArgumentError 整数や浮動小数点数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError nil またはメソッド to_f を持たないオブジェクトを引数に指定したか、
to_f が浮動小数点数を返......#=> 9.88
p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)
p Float("10") #=> 10.0
p Float("10e2") #=> 1000.0
p Float("1e-2") #=> 0.01
p Float(".1")... -
Marshal
. # dump(obj , limit = -1) -> String (8018.0) -
obj を指定された出力先に再帰的に出力します。
...力先に再帰的に出力します。
ファイルに書き出せないオブジェクトをファイルに書き出そうとすると
例外 TypeError が発生します。
ファイルに書き出せないオブジェクトは以下の通りです。
* 名前のついてない Class/Module......指していることになります。
//emlist[例][ruby]{
p Marshal.dump(Hash.new {})
# => -:1:in `dump': cannot dump hash with default proc (TypeError)
//}
マーシャルの動作を任意に定義することもできます。
@param obj ダンプする対象のオブジェクトを指定......n port を省略すると、obj をダンプした String を返します。
port を指定すると port を返します。
@raise TypeError ファイルに書き出せないオブジェクトをファイルに
書きだそうとした場合に発生します。
@rai... -
Marshal
. # dump(obj , port , limit = -1) -> IO (8018.0) -
obj を指定された出力先に再帰的に出力します。
...力先に再帰的に出力します。
ファイルに書き出せないオブジェクトをファイルに書き出そうとすると
例外 TypeError が発生します。
ファイルに書き出せないオブジェクトは以下の通りです。
* 名前のついてない Class/Module......指していることになります。
//emlist[例][ruby]{
p Marshal.dump(Hash.new {})
# => -:1:in `dump': cannot dump hash with default proc (TypeError)
//}
マーシャルの動作を任意に定義することもできます。
@param obj ダンプする対象のオブジェクトを指定......n port を省略すると、obj をダンプした String を返します。
port を指定すると port を返します。
@raise TypeError ファイルに書き出せないオブジェクトをファイルに
書きだそうとした場合に発生します。
@rai... -
ENV
. dup -> () (8016.0) -
TypeErrorを発生させます。
...TypeErrorを発生させます。
3.0 以前では Object.new と同様の ENV とは無関係の有用ではないオブジェクトを返していたため、3.1 からは例外が発生するようになりました。
詳細はENV.cloneを参照してください。
@see ENV.clone... -
ENV
. freeze -> () (8016.0) -
ENV.freeze は環境変数の変更を禁止できないため、TypeErrorを発生させます。
...ENV.freeze は環境変数の変更を禁止できないため、TypeErrorを発生させます。... -
Array
# []=(start , length , val) (8013.0) -
インデックス start から length 個の要素を配列 val の内容で置き換えます。 start が自身の末尾を越える時には配列の長さを自動的に拡張し、拡張した領域を nil で初期化します。
..., 2, 3, 4, 5]
a[2, 3] = []
p a # => [0, 1, 5]
//}
@raise TypeError 引数 start、length に整数以外の(暗黙の型変換が行えな
い)オブジェクトを指定した場合に発生します。
@raise TypeError 引数 val に配列以外の(暗黙の型変換が行え... -
Array
# transpose -> Array (8012.0) -
自身を行列と見立てて、行列の転置(行と列の入れ換え)を行いま す。転置した配列を生成して返します。空の配列に対しては空の配列を生 成して返します。
...返します。空の配列に対しては空の配列を生
成して返します。
それ以外の一次元の配列に対しては、例外
TypeError が発生します。各要素のサイズが不揃いな配列に対して
は、例外 IndexError が発生します。
//emlist[例][ruby]{
p......[5,6]].transpose
# => [[1, 3, 5], [2, 4, 6]]
p [].transpose
# => []
p [1,2,3].transpose
# => -:1:in `transpose': cannot convert Fixnum into Array (TypeError)
# from -:1
p [[1,2],
[3,4,5],
[6,7]].transpose
# => -:3:in `transpose': element size differ (3 should be 2) (IndexError)
//}... -
Kernel
. # Hash(arg) -> Hash (8012.0) -
引数 arg で指定したオブジェクトを to_hash メソッドを呼び出す事で Hash オブジェクトに変換します。nil か [] を指定した場合は空の Hash オブジェクトを返します。
...対象のオブジェクトを指定します。
//emlist[例][ruby]{
Hash([]) # => {}
Hash(nil) # => {}
Hash(key: :value) # => {:key => :value}
Hash([1, 2, 3]) # => TypeError
//}
@raise TypeError 変換できないオブジェクトを指定した場合に発生します。...