Class: Hash

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

Class Method Summary collapse

Class Method Details

.lr_convert_hash_keys(value) ⇒ Object

lr_ appended so no method naming conflicts with other gems



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

def self.lr_convert_hash_keys(value) #lr_ appended so no method naming conflicts with other gems
  case value
    when Array
      value.map { |v| lr_convert_hash_keys(v) }
    when Hash
      Hash[value.map { |k, v| [k.to_s.lr_underscore, lr_convert_hash_keys(v)] }]
    else
      value
   end
end