Module: Hashie::Extensions::StringifyKeys

Extended by:
ClassMethods
Included in:
Hash
Defined in:
lib/hashie/extensions/stringify_keys.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from ClassMethods

stringify_keys_recursively!

Instance Method Details

#stringify_keysObject

Return a new hash with all keys converted to strings.



17
18
19
# File 'lib/hashie/extensions/stringify_keys.rb', line 17

def stringify_keys
  StringifyKeys.stringify_keys(self)
end

#stringify_keys!Object

Convert all keys in the hash to strings.

Examples:

test = {:abc => 'def'}
test.stringify_keys!
test # => {'abc' => 'def'}


10
11
12
13
# File 'lib/hashie/extensions/stringify_keys.rb', line 10

def stringify_keys!
  StringifyKeys.stringify_keys!(self)
  self
end