Module: Puppet::Parser::Methods

Extended by:
Util
Defined in:
lib/puppet/parser/methods.rb

Overview

A module for handling finding and invoking methods (functions invokable as a method). A method call on the form:

$a.meth(1,2,3] {|...| ...}

will lookup a function called ‘meth’ and call it with the arguments ($a, 1, 2, 3, <lambda>)

See Also:

Since:

  • 3.2

Defined Under Namespace

Classes: Method

Constant Summary collapse

Environment =

Since:

  • 3.2

Puppet::Node::Environment

Constants included from Util

Util::AbsolutePathPosix, Util::AbsolutePathWindows, Util::DEFAULT_POSIX_MODE, Util::DEFAULT_WINDOWS_MODE

Constants included from Util::POSIX

Util::POSIX::LOCALE_ENV_VARS, Util::POSIX::USER_ENV_VARS

Constants included from Util::SymbolicFileMode

Util::SymbolicFileMode::SetGIDBit, Util::SymbolicFileMode::SetUIDBit, Util::SymbolicFileMode::StickyBit, Util::SymbolicFileMode::SymbolicMode, Util::SymbolicFileMode::SymbolicSpecialToBit

Class Method Summary collapse

Methods included from Util

absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, deterministic_rand, execfail, execpipe, execute, exit_on_fail, logmethods, memory, path_to_uri, pretty_backtrace, proxy, replace_file, safe_posix_fork, symbolizehash, thinmark, uri_to_path, which, withenv, withumask

Methods included from Util::POSIX

#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Methods included from Util::SymbolicFileMode

#normalize_symbolic_mode, #symbolic_mode_to_int, #valid_symbolic_mode?

Class Method Details

.find_method(scope, receiver, name) ⇒ Method?

Finds a function and returns an instance of Method configured to perform invocation.

Returns:

  • (Method, nil)

    configured method or nil if method not found

Since:

  • 3.2



63
64
65
66
67
68
# File 'lib/puppet/parser/methods.rb', line 63

def self.find_method(scope, receiver, name)
  fname = Puppet::Parser::Functions.function(name)
  rvalue = Puppet::Parser::Functions.rvalue?(name)
  return Method.new(scope, receiver, fname, rvalue) if fname
  nil
end