るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.344秒)
トップページ > クラス:Hash[x] > ライブラリ:ビルトイン[x] > バージョン:2.6.0[x] > クエリ:_builtin[x] > クエリ:hash[x] > クエリ:transform_values![x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

検索結果

Hash#transform_values! -> Enumerator (105406.0)

すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。 キーは変化しません。

...2, b: 5, c: 10 }
h.transform_values!(&:to_s) #=> { a: "2", b: "5", c: "10" }
h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "2.0", b: "5.1", c: "10.2" }
//}

@see Hash#transform_values
@see Hash#transform_keys
@see Hash#transform_keys!...

Hash#transform_values! {|value| ... } -> self (105406.0)

すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。 キーは変化しません。

...2, b: 5, c: 10 }
h.transform_values!(&:to_s) #=> { a: "2", b: "5", c: "10" }
h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "2.0", b: "5.1", c: "10.2" }
//}

@see Hash#transform_values
@see Hash#transform_keys
@see Hash#transform_keys!...