るりまサーチ (Ruby 2.7.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.240秒)
トップページ > バージョン:2.7.0[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 (54346.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 (54346.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!...