Class: Litmus::Infrastructure::HashUtil
- Inherits:
-
Object
- Object
- Litmus::Infrastructure::HashUtil
- Defined in:
- lib/litmus/infrastructure/hash_util.rb
Overview
:nodoc:
Class Method Summary collapse
-
.camel_keys(hash) ⇒ Object
Returns a new hash with all keys converted to CameCase.
-
.underscore_keys(hash) ⇒ Object
Returns a new hash with all keys converted to :underscore_symbols from its CamelCase counterpart.
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 |