るりまサーチ

最速Rubyリファレンスマニュアル検索!
8件ヒット [1-8件を表示] (0.121秒)
トップページ > クエリ:t[x] > クエリ:ruby[x] > 種類:インスタンスメソッド[x] > クエリ:at[x] > クエリ:transform_keys![x]

別のキーワード

  1. _builtin at
  2. _builtin values_at
  3. time at
  4. dbm values_at
  5. irb irb_at_exit

ライブラリ

クラス

検索結果

Hash#transform_keys! -> Enumerator (24321.0)

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

...turn transform_keys! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。


//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys!...
...(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}

@see Hash#transform_keys
@see Hash#transform_values
@see Hash#transform_values!...
...(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!(a: "a", d: "d") # => {"a"=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}

@see Hash#transform_keys
@see Hash#transform_values
@see Hash#transf...