Method: Hash#stringify_keys
- Defined in:
- lib/core/facets/hash/symbolize_keys.rb
permalink #stringify_keys(&select) ⇒ Object
Return a new hash with all keys converted to strings. Converts all keys in the Hash to Strings, returning a new Hash. With a select
block, limits conversion to only a certain selection of keys.
foo = { :name=>'Gavin', :wife=>:Lisa }
foo.stringify_keys #=> { "name"=>"Gavin", "wife"=>:Lisa }
foo #=> { :name =>"Gavin", :wife=>:Lisa }
This method is considered archaic. Use #rekey instead.
61 62 63 |
# File 'lib/core/facets/hash/symbolize_keys.rb', line 61 def stringify_keys(&select) dup.stringify_keys!(&select) end |