3件ヒット
[1-3件を表示]
(0.061秒)
検索結果
-
KeyError
# key -> object (87385.0) -
KeyError の原因となったメソッド呼び出しのキーを返します。
KeyError の原因となったメソッド呼び出しのキーを返します。
@raise ArgumentError キーが設定されていない時に発生します。
例:
h = Hash.new
begin
h.fetch('gumby'*20)
rescue KeyError => e
p e.message # => "key not found: \"gumbygumbygumbygumbygumbygumbygumbygumbygumbygumbygumbygumbyg..."
p 'gumby'*20 == e.key # => ... -
Hash
# to _ h {|key , value| block } -> Hash (24385.0) -
self を返します。Hash クラスのサブクラスから呼び出した場合は self を Hash オブジェクトに変換します。
self を返します。Hash クラスのサブクラスから呼び出した場合は
self を Hash オブジェクトに変換します。
//emlist[例][ruby]{
hash = {}
p hash.to_h # => {}
p hash.to_h == hash # => true
class MyHash < Hash;end
my_hash = MyHash.new
p my_hash.to_h # => {}
p my_hash.class # => MyHash
p my_hash.to_h.class # => Hash
//}
ブロックを... -
Hash
# to _ h -> self | Hash (24085.0) -
self を返します。Hash クラスのサブクラスから呼び出した場合は self を Hash オブジェクトに変換します。
self を返します。Hash クラスのサブクラスから呼び出した場合は
self を Hash オブジェクトに変換します。
//emlist[例][ruby]{
hash = {}
p hash.to_h # => {}
p hash.to_h == hash # => true
class MyHash < Hash;end
my_hash = MyHash.new
p my_hash.to_h # => {}
p my_hash.class # => MyHash
p my_hash.to_h.class # => Hash
//}
ブロックを...