Module: HashExtension
- Defined in:
- lib/support/hash_extensions.rb
Overview
ActiveSupport’s corresponding methods
- https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/hash
Instance Method Summary collapse
Instance Method Details
#deep_merge(other_hash, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/support/hash_extensions.rb', line 6 def deep_merge(other_hash, &block) merge(other_hash) do |key, this_val, other_val| if this_val.is_a?(Hash) && other_val.is_a?(Hash) this_val.deep_merge other_val, &block elsif block_given? block.call key, this_val, other_val else other_val end end end |