Class: Hash
- Defined in:
- lib/syncwise_api/ext/core_ext.rb,
lib/syncwise_api/ext/core_ext.rb
Overview
so there are some things from Rails I love, and have a hard time living without when using PORO. i’m adding them back here. thanks, Rails Core team ;)
Instance Method Summary collapse
- #deep_symbolize_keys ⇒ Object (also: #symbolize_keys)
Instance Method Details
#deep_symbolize_keys ⇒ Object Also known as: symbolize_keys
8 9 10 11 12 13 14 |
# File 'lib/syncwise_api/ext/core_ext.rb', line 8 def deep_symbolize_keys result = {} each do |key, value| result[(key.underscore.dehumanize.to_sym rescue key)] = value.is_a?(Hash) ? value.deep_symbolize_keys : value end result end |