るりまサーチ (Ruby 3.1)

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

Struct#deconstruct -> [object] (54304.0)

構造体のメンバの値を配列にいれて返します。

構造体のメンバの値を配列にいれて返します。

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

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してくだ...

Struct#deconstruct_keys(array_of_names) -> Hash (18340.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...

Struct#to_a -> [object] (9004.0)

構造体のメンバの値を配列にいれて返します。

構造体のメンバの値を配列にいれて返します。

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

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してくだ...

Struct#values -> [object] (9004.0)

構造体のメンバの値を配列にいれて返します。

構造体のメンバの値を配列にいれて返します。

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

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してくだ...

パターンマッチ (307.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 パターンの構文は将来的に変更の可能性がありま...

絞り込み条件を変える