るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. objectspace each_object
  2. _builtin each_object
  3. object send
  4. object to_enum
  5. object public_send

ライブラリ

クラス

検索結果

Hash#replace(other) -> self (81505.0)

ハッシュの内容を other の内容で置き換えます。

ハッシュの内容を other の内容で置き換えます。

デフォルト値の設定もotherの内容になります。
otherがハッシュではない場合、otherのメソッドto_hashを使って暗黙の変換を試みます。

self = other.to_hash.dup と同じです。

@param other ハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return self を返します。

//emlist[例][ruby]{
foo = {1 => 'a', 2 => 'b'}
bar = {2 => 'B', 3 => 'C'}

foo.replace(b...