るりまサーチ (Ruby 3.1)

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

別のキーワード

  1. _builtin deconstruct_keys
  2. _builtin deconstruct
  3. struct deconstruct_keys
  4. struct deconstruct
  5. date deconstruct_keys

ライブラリ

クラス

検索結果

Struct#deconstruct_keys(array_of_names) -> Hash (54340.0)

self のメンバの名前と値の組を Hash で返します。

self のメンバの名前と値の組を Hash で返します。

@param array_of_names 返り値に含めるメンバの名前の配列を指定します。nil の場合は全てのメンバを意味します。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
h = joe.deconstruct_keys([:zip, :address])
h # => {:zip=>12345, :address...

パターンマッチ (163.0)

パターンマッチ * patterns * variable_binding * variable_pinning * matching_non_primitive_objects * guard_clauses * current_feature_status * pattern_syntax * some_undefined_behavior_examples

...by]{
case [1, 1]
in a, b unless b == a*2
"matched"
else
"not matched"
end
#=> "matched"
//}

===[a:current_feature_status] 機能の現状

Ruby 3.1 の時点では、Find パターンは 「実験的機能」 扱いです。Find パターンの構文は将来的に変更の可能性がありま...