Class: Litmus::Infrastructure::HashUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/litmus/infrastructure/hash_util.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.camel_keys(hash) ⇒ Object

Returns a new hash with all keys converted to CameCase



14
15
16
# File 'lib/litmus/infrastructure/hash_util.rb', line 14

def self.camel_keys(hash)
  deep_transform_keys(hash) { |key| key.to_s.camelcase.to_s }
end

.underscore_keys(hash) ⇒ Object

Returns a new hash with all keys converted to :underscore_symbols from its CamelCase counterpart



9
10
11
# File 'lib/litmus/infrastructure/hash_util.rb', line 9

def self.underscore_keys(hash)
  deep_transform_keys(hash) { |key| key.underscore.to_sym }
end