Module: DeepMerge::DeepMergeHash

Included in:
Hash
Defined in:
lib/puppet/vendor/deep_merge/lib/deep_merge/deep_merge_hash.rb

Instance Method Summary collapse

Instance Method Details

#deep_merge(source, options = {}) ⇒ Object

deep_merge will merge and skip any unmergeables in destination hash



18
19
20
21
# File 'lib/puppet/vendor/deep_merge/lib/deep_merge/deep_merge_hash.rb', line 18

def deep_merge(source, options = {})
  default_opts = {:preserve_unmergeables => true}
  DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end

#deep_merge!(source, options = {}) ⇒ Object

deep_merge! will merge and overwrite any unmergeables in destination hash



12
13
14
15
# File 'lib/puppet/vendor/deep_merge/lib/deep_merge/deep_merge_hash.rb', line 12

def deep_merge!(source, options = {})
  default_opts = {:preserve_unmergeables => false}
  DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end

#ko_deep_merge!(source, options = {}) ⇒ Object

ko_hash_merge! will merge and knockout elements prefixed with DEFAULT_FIELD_KNOCKOUT_PREFIX



6
7
8
9
# File 'lib/puppet/vendor/deep_merge/lib/deep_merge/deep_merge_hash.rb', line 6

def ko_deep_merge!(source, options = {})
  default_opts = {:knockout_prefix => "--", :preserve_unmergeables => false}
  DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end