Class: Puppet::Pops::Lookup::LookupKeyFunctionProvider Private

Inherits:
FunctionProvider show all
Defined in:
lib/puppet/pops/lookup/lookup_key_function_provider.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

V3LookupKeyFunctionProvider

Constant Summary collapse

TAG =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'lookup_key'

Instance Attribute Summary

Attributes inherited from FunctionProvider

#function_name, #locations, #parent_data_provider

Instance Method Summary collapse

Methods inherited from FunctionProvider

#create_function_context, #full_name, #function_context, #initialize, #module_name, #name, #options, #to_s, trusted_return_type, #value_is_validated?

Methods included from DataProvider

#key_lookup, #key_lookup_in_default, key_type, #lookup, #module_name, #name, register_types, #validate_data_hash, #validate_data_value, #value_is_validated?, value_type

Constructor Details

This class inherits a constructor from Puppet::Pops::Lookup::FunctionProvider

Instance Method Details

#invoke_with_location(lookup_invocation, location, root_key, merge) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/puppet/pops/lookup/lookup_key_function_provider.rb', line 27

def invoke_with_location(lookup_invocation, location, root_key, merge)
  if location.nil?
    value = lookup_key(root_key, lookup_invocation, nil, merge)
    lookup_invocation.report_found(root_key, value)
  else
    lookup_invocation.with(:location, location) do
      value = lookup_key(root_key, lookup_invocation, location, merge)
      lookup_invocation.report_found(root_key, value)
    end
  end
end

#labelObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/puppet/pops/lookup/lookup_key_function_provider.rb', line 39

def label
  'Lookup Key'
end

#unchecked_key_lookup(key, lookup_invocation, merge) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Performs a lookup with the assumption that a recursive check has been made.

Parameters:

  • key (LookupKey)

    The key to lookup

  • lookup_invocation (Invocation)

    The current lookup invocation

  • merge (MergeStrategy, String, Hash{String => Object}, nil)

    Merge strategy, merge strategy name, strategy and options hash, or nil (implies “first found”)

Returns:

  • (Object)

    the found object



18
19
20
21
22
23
24
25
# File 'lib/puppet/pops/lookup/lookup_key_function_provider.rb', line 18

def unchecked_key_lookup(key, lookup_invocation, merge)
  root_key = key.root_key
  lookup_invocation.with(:data_provider, self) do
    MergeStrategy.strategy(merge).lookup(locations, lookup_invocation) do |location|
      invoke_with_location(lookup_invocation, location, root_key, merge)
    end
  end
end