Module: Hashie::Extensions::SymbolizeKeys

Extended by:
ClassMethods
Defined in:
lib/hashie/extensions/symbolize_keys.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from ClassMethods

symbolize_keys_recursively!

Instance Method Details

#symbolize_keysObject

Return a new hash with all keys converted to symbols.


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

def symbolize_keys
  SymbolizeKeys.symbolize_keys(self)
end

#symbolize_keys!Object

Convert all keys in the hash to symbols.

Examples:

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

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

def symbolize_keys!
  SymbolizeKeys.symbolize_keys!(self)
  self
end