113件ヒット
[101-113件を表示]
(0.111秒)
別のキーワード
クラス
- Array (19)
- Data (6)
- Hash (31)
- OpenStruct (19)
- Struct (19)
モジュール
- Enumerable (19)
検索結果
-
Struct
# to _ h -> Hash (24230.0) -
self のメンバ名(Symbol)と値の組を Hash にして返します。
...
self のメンバ名(Symbol)と値の組を Hash にして返します。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345).to_h
# => {:name=>"Joe Smith", :address=>"123 Maple, Anytown NC", :zip=>12345}
//}
[注意] 本メ......ソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。... -
Hash
# to _ hash -> self (12330.0) -
self を返します。
...
self を返します。
//emlist[例][ruby]{
hash = {}
p hash.to_hash # => {}
p hash.to_hash == hash # => true
//}
@see Object#to_hash, Hash#to_h...