class Puppet::Pops::FirstFoundStrategy

Simple strategy that returns the first value found. It never merges any values.

Constants

INSTANCE

Public Class Methods

key() click to toggle source
    # File lib/puppet/pops/merge_strategy.rb
208 def self.key
209   :first
210 end

Public Instance Methods

lookup(lookup_variants, _) { |lookup_variant| ... } click to toggle source

Returns the first value found

@param lookup_variants [Array] The variants to pass as second argument to the given block @return [Object] the merged value @throws :no_such_key unless the lookup was successful

    # File lib/puppet/pops/merge_strategy.rb
218 def lookup(lookup_variants, _)
219   # First found does not continue when a root key was found and a subkey wasn't since that would
220   # simulate a hash merge
221   lookup_variants.each { |lookup_variant| catch(:no_such_key) { return yield(lookup_variant) } }
222   throw :no_such_key
223 end

Protected Instance Methods

value_t() click to toggle source
    # File lib/puppet/pops/merge_strategy.rb
227 def value_t
228   @value_t ||= Types::PAnyType::DEFAULT
229 end