Module: ThousandIsland::Utilities::DeepMerge
- Included in:
- TableOptions, TemplateOptions
- Defined in:
- lib/thousand_island/utilities/utilities.rb
Defined Under Namespace
Modules: TableOptions, TemplateOptions
Instance Method Summary collapse
Instance Method Details
#merge_for_key_and_nested_keys(key, keys, *hashes) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/thousand_island/utilities/utilities.rb', line 6 def merge_for_key_and_nested_keys(key, keys, *hashes) temp = {} merged = {} hashes.each do |h| keys.each do |k| temp[k] = {} unless temp.has_key? k temp[k].merge!(h[key][k]) if h[key] && h[key][k] end merged.merge!(h[key]) if h[key] end merged.merge(temp) end |