るりまサーチ

最速Rubyリファレンスマニュアル検索!
113件ヒット [101-113件を表示] (0.111秒)

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

クラス

モジュール

検索結果

<< < 1 2 >>

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...
<< < 1 2 >>