Class: Puppet::Pops::Lookup::DataDigFunctionProvider Private
- Inherits:
-
FunctionProvider
- Object
- FunctionProvider
- Puppet::Pops::Lookup::DataDigFunctionProvider
- Defined in:
- lib/puppet/pops/lookup/data_dig_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
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.
'data_dig'
Instance Attribute Summary
Attributes inherited from FunctionProvider
#function_name, #locations, #parent_data_provider
Instance Method Summary collapse
- #invoke_with_location(lookup_invocation, location, key, merge) ⇒ Object private
- #label ⇒ Object private
-
#unchecked_key_lookup(key, lookup_invocation, merge) ⇒ Object
private
Performs a lookup with the assumption that a recursive check has been made.
- #validated_data_dig(key, lookup_invocation, location, merge) ⇒ Object private
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, 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.
26 27 28 29 30 31 32 33 34 |
# File 'lib/puppet/pops/lookup/data_dig_function_provider.rb', line 26 def invoke_with_location(lookup_invocation, location, key, merge) if location.nil? key.undig(lookup_invocation.report_found(key, validated_data_dig(key, lookup_invocation, nil, merge))) else lookup_invocation.with(:location, location) do key.undig(lookup_invocation.report_found(key, validated_data_dig(key, lookup_invocation, location, merge))) end end end |
#label ⇒ 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.
36 37 38 |
# File 'lib/puppet/pops/lookup/data_dig_function_provider.rb', line 36 def label 'Data Dig' 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.
18 19 20 21 22 23 24 |
# File 'lib/puppet/pops/lookup/data_dig_function_provider.rb', line 18 def unchecked_key_lookup(key, lookup_invocation, merge) lookup_invocation.with(:data_provider, self) do MergeStrategy.strategy(merge).lookup(locations, lookup_invocation) do |location| invoke_with_location(lookup_invocation, location, key, merge) end end end |
#validated_data_dig(key, lookup_invocation, location, 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.
40 41 42 43 44 45 |
# File 'lib/puppet/pops/lookup/data_dig_function_provider.rb', line 40 def validated_data_dig(key, lookup_invocation, location, merge) validate_data_value(data_dig(key, lookup_invocation, location, merge)) do msg = "Value for key '#{key}', returned from #{full_name}" location.nil? ? msg : "#{msg}, when using location '#{location}'," end end |