class Puppet::Functions::InternalDispatchBuilder
Injection and Weaving of parameters
It is possible to inject and weave a set of well known parameters into a call. These extra parameters are not part of the parameters passed from the Puppet
logic, and they can not be overridden by parameters given as arguments in the call. They are invisible to the Puppet
Language.
@example using injected parameters
Puppet::Functions.create_function('test') do dispatch :test do param 'Scalar', 'a' param 'Scalar', 'b' scope_param end def test(a, b, scope) a > b ? scope['a'] : scope['b'] end end
The function in the example above is called like this:
test(10, 20)
@api private
Public Instance Methods
cache_param()
click to toggle source
Inject a parameter getting a cached hash for this function
# File lib/puppet/functions.rb 840 def cache_param 841 inject(:cache) 842 end
compiler_param()
click to toggle source
Inject parameter for `Puppet::Pal::CatalogCompiler`
# File lib/puppet/functions.rb 845 def compiler_param 846 inject(:pal_catalog_compiler) 847 end
pal_compiler_param()
click to toggle source
Inject parameter for either `Puppet::Pal::CatalogCompiler` or `Puppet::Pal::ScriptCompiler`
# File lib/puppet/functions.rb 850 def pal_compiler_param 851 inject(:pal_compiler) 852 end
scope_param()
click to toggle source
Inject parameter for `Puppet::Parser::Scope`
# File lib/puppet/functions.rb 830 def scope_param 831 inject(:scope) 832 end
script_compiler_param()
click to toggle source
Inject parameter for `Puppet::Pal::ScriptCompiler`
# File lib/puppet/functions.rb 835 def script_compiler_param 836 inject(:pal_script_compiler) 837 end
Private Instance Methods
inject(injection_name)
click to toggle source
# File lib/puppet/functions.rb 856 def inject(injection_name) 857 @injections << injection_name 858 # mark what should be picked for this position when dispatching 859 @weaving << [@injections.size()-1] 860 end