Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/magistrate/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#recursive_symbolize_keys!Object



9
10
11
12
# File 'lib/magistrate/core_ext.rb', line 9

def recursive_symbolize_keys!
  symbolize_keys!
  values.select { |v| v.is_a?(Hash) }.each { |h| h.recursive_symbolize_keys! }
end

#symbolize_keys!Object



2
3
4
5
6
7
# File 'lib/magistrate/core_ext.rb', line 2

def symbolize_keys!
    keys.each do |key|
    self[(key.to_sym rescue key) || key] = delete(key)
  end
  self
end