Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/middleman-ogp/extension.rb
Overview
Hash extension
Instance Method Summary collapse
Instance Method Details
#deep_merge4(other_hash, &block) ⇒ Object
177 178 179 |
# File 'lib/middleman-ogp/extension.rb', line 177 def deep_merge4(other_hash, &block) dup.deep_merge4!(other_hash, &block) end |
#deep_merge4!(other_hash, &block) ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/middleman-ogp/extension.rb', line 181 def deep_merge4!(other_hash, &block) other_hash.each_pair do |k, v| tv = self[k] self[k] = if tv.is_a?(Hash) && v.is_a?(Hash) tv.deep_merge4(v, &block) else block && tv ? block.call(k, tv, v) : v end end self end |