Class: Hash

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

Instance Method Summary collapse

Instance Method Details

#to_lower_camel_keys(value = self) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/plus4u_codebase/case_conversions.rb', line 30

def to_lower_camel_keys(value = self)
  case value
    when Array
      value.map { |v| camel_hash(v) }
    when Hash
      camel_hash(value)
    else
      value
  end
end

#to_snake_keys(value = self) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/plus4u_codebase/case_conversions.rb', line 19

def to_snake_keys(value = self)
  case value
    when Array
      value.map { |v| snake_hash(v) }
    when Hash
      snake_hash(value)
    else
      value
  end
end