Represents an invokable method configured to be invoked for a given object.
Invoke this method’s function in the given scope with the given arguments and parameterized block. A method call on the form:
$a.meth(1,2,3) {|...| ...}
results in the equivalent:
meth($a, 1, 2, 3, {|...| ... })
@param scope [Puppet::Parser::Scope] the scope the call takes place in @param args [Array<Object>] arguments 1..n to pass to the function @param pblock [Puppet::Parser::AST::Lambda] optional parameterized block to pass as the last argument
to the called function
# File lib/puppet/parser/methods.rb, line 45 def invoke(scope, args=[], pblock=nil) arguments = [@o] + args arguments << pblock if pblock @receiver.send(@method_name, arguments) end
@return [Boolean] whether the method function produces an rvalue or not.
# File lib/puppet/parser/methods.rb, line 52 def is_rvalue? @rvalue end
# File lib/puppet/parser/methods.rb, line 24 def initialize(receiver, obj, method_name, rvalue) @receiver = receiver @o = obj @method_name = method_name @rvalue = rvalue end