Class: Puppet::Pops::HashMergeStrategy

Inherits:
MergeStrategy show all
Defined in:
lib/puppet/pops/merge_strategy.rb

Overview

Produces a new hash by merging hash e1 with hash e2 in such a way that the values of duplicate keys will be those of e1

API:

  • public

Constant Summary

Constants inherited from MergeStrategy

MergeStrategy::NOT_FOUND

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MergeStrategy

add_strategy, #configuration, #convert_value, #initialize, merge, #merge, #merge_lookup, #options, strategy, strategy_keys

Constructor Details

This class inherits a constructor from Puppet::Pops::MergeStrategy

Class Method Details

.keyObject

API:

  • public



205
206
207
# File 'lib/puppet/pops/merge_strategy.rb', line 205

def self.key
  :hash
end

Instance Method Details

#checked_merge(e1, e2) ⇒ Hash<String,Object]

Returns The merged hash.

Parameters:

  • The hash that will act as the source of the merge

  • The hash that will act as the receiver for the merge

Returns:

  • The merged hash

See Also:

  • Hash#merge

API:

  • public



213
214
215
# File 'lib/puppet/pops/merge_strategy.rb', line 213

def checked_merge(e1, e2)
  e2.merge(e1)
end