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
209 def self.key
210   :first
211 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
219 def lookup(lookup_variants, _)
220   # First found does not continue when a root key was found and a subkey wasn't since that would
221   # simulate a hash merge
222   lookup_variants.each { |lookup_variant| catch(:no_such_key) { return yield(lookup_variant) } }
223   throw :no_such_key
224 end

Protected Instance Methods

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