Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/price_hubble/core_ext/hash.rb
Overview
All our Ruby core extensions for the Hash
class.
Instance Method Summary collapse
-
#deep_camelize_keys ⇒ Hash
Perform a deep key transformation on the hash, so all keys are in camelcase.
-
#deep_compact ⇒ Hash
Perform the regular Hash#compact method on the object but takes care of deeply nested hashs.
-
#deep_underscore_keys ⇒ Hash
Perform a deep key transformation on the hash, so all keys are in snakecase/underscored.
Instance Method Details
#deep_camelize_keys ⇒ Hash
Perform a deep key transformation on the hash, so all keys are in camelcase.
17 18 19 |
# File 'lib/price_hubble/core_ext/hash.rb', line 17 def deep_camelize_keys deep_transform_keys { |key| key.to_s.camelize(:lower) } end |
#deep_compact ⇒ Hash
Perform the regular Hash#compact method on the object but takes care of deeply nested hashs.
9 10 11 |
# File 'lib/price_hubble/core_ext/hash.rb', line 9 def deep_compact deep_compact_in_object(self) end |
#deep_underscore_keys ⇒ Hash
Perform a deep key transformation on the hash, so all keys are in snakecase/underscored.
25 26 27 |
# File 'lib/price_hubble/core_ext/hash.rb', line 25 def deep_underscore_keys deep_transform_keys { |key| key.to_s.underscore } end |