| Class | Hash |
| In: |
lib/hashery/core_ext.rb
lib/hashery/stash.rb |
| Parent: | Object |
Synonym for Hash#rekey, but modifies the receiver in place (and returns it).
key_map - Hash of old key to new key. block - Procedure to convert keys, which can take just the key
or both key and value as arguments.
Examples
foo = { :name=>'Gavin', :wife=>:Lisa }
foo.rekey!{ |k| k.to_s } #=> { "name"=>"Gavin", "wife"=>:Lisa }
foo.inspect #=> { "name"=>"Gavin", "wife"=>:Lisa }
Returns `Hash`.
Synonym for Hash#rekey, but modifies the receiver in place (and returns it).
key_map - Hash of old key to new key. block - Procedure to convert keys, which can take just the key
or both key and value as arguments.
Examples
foo = { :name=>'Gavin', :wife=>:Lisa }
foo.rekey!{ |k| k.to_s } #=> { "name"=>"Gavin", "wife"=>:Lisa }
foo #=> { "name"=>"Gavin", "wife"=>:Lisa }
Returns `Hash`.