Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/vorhees/client.rb

Instance Method Summary collapse

Instance Method Details

#symbolize_keysObject

Return a new hash with all keys converted to symbols.



7
8
9
10
11
12
# File 'lib/vorhees/client.rb', line 7

def symbolize_keys
  inject({}) do |options, (key, value)|
    options[(key.to_sym rescue key) || key] = value
    options
  end
end

#symbolize_keys!Object

Destructively convert all keys to symbols.



15
16
17
# File 'lib/vorhees/client.rb', line 15

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