Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/poisol/extensions/hash.rb

Instance Method Summary collapse

Instance Method Details

#camelize_keysObject



2
3
4
5
6
7
8
9
# File 'lib/poisol/extensions/hash.rb', line 2

def camelize_keys
  Hash[
    self.map do |key,value| 
      value = value.camelize_keys if value.class.name.eql?("Hash")
      [key.to_s.camelize(:lower),value ]
    end
  ]
end

#stringify_keysObject



11
12
13
14
15
16
17
18
# File 'lib/poisol/extensions/hash.rb', line 11

def stringify_keys
  Hash[
    self.map do |key,value| 
      value = value.stringify_keys if value.class.name.eql?("Hash")
      [key.to_s,value ]
    end
  ]
end