Class: Puppet::Pops::Lookup::FunctionProvider Private
- Includes:
- DataProvider
- Defined in:
- lib/puppet/pops/lookup/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
DataDigFunctionProvider, DataHashFunctionProvider, LookupKeyFunctionProvider
Instance Attribute Summary collapse
- #function_name ⇒ Object readonly private
- #locations ⇒ Object readonly private
- #parent_data_provider ⇒ Object readonly private
Class Method Summary collapse
-
.trusted_return_type ⇒ Type
private
Returns the type that all the return type of all functions must be assignable to.
Instance Method Summary collapse
- #create_function_context(lookup_invocation) ⇒ Object private
- #full_name ⇒ Object private
-
#function_context(lookup_invocation, location) ⇒ FunctionContext
private
The function context associated with this provider.
-
#initialize(name, parent_data_provider, function_name, options, locations) ⇒ FunctionProvider
constructor
private
A new instance of FunctionProvider.
- #module_name ⇒ Object private
- #name ⇒ Object private
-
#options(location = nil) ⇒ Hash{String => Object}
private
Obtains the options to send to the function, optionally merged with a ‘path’ or ‘uri’ option.
- #to_s ⇒ Object private
- #value_is_validated? ⇒ Boolean private
Methods included from DataProvider
#key_lookup, #key_lookup_in_default, key_type, #lookup, register_types, #unchecked_key_lookup, #validate_data_hash, #validate_data_value, value_type
Constructor Details
#initialize(name, parent_data_provider, function_name, options, locations) ⇒ FunctionProvider
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.
Returns a new instance of FunctionProvider.
22 23 24 25 26 27 28 29 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 22 def initialize(name, parent_data_provider, function_name, , locations) @name = name @parent_data_provider = parent_data_provider @function_name = function_name @options = @locations = locations || [nil] @contexts = {} end |
Instance Attribute Details
#function_name ⇒ Object (readonly)
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.
11 12 13 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 11 def function_name @function_name end |
#locations ⇒ Object (readonly)
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.
11 12 13 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 11 def locations @locations end |
#parent_data_provider ⇒ Object (readonly)
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.
11 12 13 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 11 def parent_data_provider @parent_data_provider end |
Class Method Details
.trusted_return_type ⇒ Type
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.
Returns the type that all the return type of all functions must be assignable to. For ‘lookup_key` and `data_dig`, that will be the `Puppet::LookupValue` type. For `data_hash` it will be a Hash`
18 19 20 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 18 def self.trusted_return_type DataProvider.value_type end |
Instance Method Details
#create_function_context(lookup_invocation) ⇒ 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/function_provider.rb', line 36 def create_function_context(lookup_invocation) FunctionContext.new(EnvironmentContext.adapt(lookup_invocation.scope.compiler.environment), module_name, function(lookup_invocation)) end |
#full_name ⇒ 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.
48 49 50 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 48 def full_name "#{self.class::TAG} function '#{@function_name}'" end |
#function_context(lookup_invocation, location) ⇒ FunctionContext
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.
Returns the function context associated with this provider.
32 33 34 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 32 def function_context(lookup_invocation, location) @contexts[location] ||= create_function_context(lookup_invocation) end |
#module_name ⇒ 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 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 40 def module_name @parent_data_provider.module_name end |
#name ⇒ 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.
44 45 46 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 44 def name "Hierarchy entry \"#{@name}\"" end |
#options(location = nil) ⇒ Hash{String => 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.
Obtains the options to send to the function, optionally merged with a ‘path’ or ‘uri’ option
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 60 def (location = nil) location = location.location unless location.nil? case location when Pathname @options.merge(HieraConfig::KEY_PATH => location.to_s) when URI @options.merge(HieraConfig::KEY_URI => location.to_s) else @options end end |
#to_s ⇒ 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.
52 53 54 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 52 def to_s name end |
#value_is_validated? ⇒ Boolean
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.
72 73 74 |
# File 'lib/puppet/pops/lookup/function_provider.rb', line 72 def value_is_validated? @value_is_validated end |