Class: Puppet::Functions::Function

Inherits:
Pops::Functions::Function show all
Defined in:
lib/puppet/functions.rb

Overview

Function

This class is the base class for all Puppet 4x Function API functions. A specialized class is created for each puppet function.

Direct Known Subclasses

InternalFunction

Instance Attribute Summary

Attributes inherited from Pops::Functions::Function

#closure_scope, #loader

Class Method Summary collapse

Methods inherited from Pops::Functions::Function

#call, #call_function, dispatcher, #initialize, signatures

Constructor Details

This class inherits a constructor from Puppet::Pops::Functions::Function

Class Method Details

.builderObject

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.



230
231
232
233
234
# File 'lib/puppet/functions.rb', line 230

def self.builder
  @type_parser ||= Puppet::Pops::Types::TypeParser.new
  @all_callables ||= Puppet::Pops::Types::TypeFactory.all_callables
  DispatcherBuilder.new(dispatcher, @type_parser, @all_callables)
end

.dispatch(meth_name, &block) ⇒ Void

Dispatch any calls that match the signature to the provided method name.

Parameters:

  • meth_name (Symbol)

    The name of the implementation method to call when the signature defined in the block matches the arguments to a call to the function.

Returns:

  • (Void)


244
245
246
247
248
# File 'lib/puppet/functions.rb', line 244

def self.dispatch(meth_name, &block)
  builder().instance_eval do
    dispatch(meth_name, &block)
  end
end