Method: Puppet::Pal::Compiler#evaluate

Defined in:
lib/puppet/pal/compiler.rb

#evaluate(ast) ⇒ Object

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.

Evaluates an AST obtained from ‘parse_string` or `parse_file` in topscope. If the ast is a `Puppet::Pops::Model::Program` (what is returned from the `parse` methods, any definitions in the program (that is, any function, plan, etc. that is defined will be made available for use).

Parameters:



109
110
111
112
113
114
115
# File 'lib/puppet/pal/compiler.rb', line 109

def evaluate(ast)
  if ast.is_a?(Puppet::Pops::Model::Program)
    loaders = Puppet.lookup(:loaders)
    loaders.instantiate_definitions(ast, loaders.public_environment_loader)
  end
  internal_evaluator.evaluate(topscope, ast)
end