Method: Puppet::Parser::Functions.function

Defined in:
lib/puppet/parser/functions.rb

.function(name, environment = Puppet.lookup(:current_environment)) ⇒ Symbol, false

Determine if a function is defined

Parameters:

  • name (Symbol)

    the function

  • environment (Puppet::Node::Environment) (defaults to: Puppet.lookup(:current_environment))

    the environment to find the function in

Returns:

  • (Symbol, false)

    The name of the function if it’s defined, otherwise false.



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/puppet/parser/functions.rb', line 198

def self.function(name, environment = Puppet.lookup(:current_environment))
  name = name.intern

  func = nil
  unless func = get_function(name, environment)
    autoloader.load(name, environment)
    func = get_function(name, environment)
  end

  if func
    func[:name]
  else
    false
  end
end