Class Puppet::Parser::AST
In: lib/puppet/parser/ast.rb
lib/puppet/parser/ast/function.rb
lib/puppet/parser/ast/tag.rb
lib/puppet/parser/ast/vardef.rb
lib/puppet/parser/ast/resourceparam.rb
lib/puppet/parser/ast/leaf.rb
lib/puppet/parser/ast/else.rb
lib/puppet/parser/ast/collection.rb
lib/puppet/parser/ast/branch.rb
lib/puppet/parser/ast/ifstatement.rb
lib/puppet/parser/ast/selector.rb
lib/puppet/parser/ast/casestatement.rb
lib/puppet/parser/ast/resource.rb
lib/puppet/parser/ast/astarray.rb
lib/puppet/parser/ast/collexpr.rb
lib/puppet/parser/ast/caseopt.rb
lib/puppet/parser/ast/resource_defaults.rb
lib/puppet/parser/ast/resource_reference.rb
lib/puppet/parser/ast/resource_override.rb
Parent: Object

An object that collects stored objects from the central cache and returns them to the current host, yo.

Methods

Included Modules

Puppet::Util::Errors Puppet::Util::MethodHelper

Classes and Modules

Class Puppet::Parser::AST::ASTArray
Class Puppet::Parser::AST::Boolean
Class Puppet::Parser::AST::Branch
Class Puppet::Parser::AST::CaseOpt
Class Puppet::Parser::AST::CaseStatement
Class Puppet::Parser::AST::ClassName
Class Puppet::Parser::AST::CollExpr
Class Puppet::Parser::AST::Collection
Class Puppet::Parser::AST::Default
Class Puppet::Parser::AST::Definition
Class Puppet::Parser::AST::Else
Class Puppet::Parser::AST::FlatString
Class Puppet::Parser::AST::Function
Class Puppet::Parser::AST::HostClass
Class Puppet::Parser::AST::HostName
Class Puppet::Parser::AST::IfStatement
Class Puppet::Parser::AST::Leaf
Class Puppet::Parser::AST::Name
Class Puppet::Parser::AST::Node
Class Puppet::Parser::AST::Resource
Class Puppet::Parser::AST::ResourceDefaults
Class Puppet::Parser::AST::ResourceInstance
Class Puppet::Parser::AST::ResourceOverride
Class Puppet::Parser::AST::ResourceParam
Class Puppet::Parser::AST::ResourceReference
Class Puppet::Parser::AST::Selector
Class Puppet::Parser::AST::String
Class Puppet::Parser::AST::Tag
Class Puppet::Parser::AST::Type
Class Puppet::Parser::AST::Undef
Class Puppet::Parser::AST::VarDef
Class Puppet::Parser::AST::Variable

Constants

AST = Puppet::Parser::AST   Do this so I don‘t have to type the full path in all of the subclasses

Attributes

file  [RW] 
line  [RW] 
parent  [RW] 
scope  [RW] 

Public Class methods

Initialize the object. Requires a hash as the argument, and takes each of the parameters of the hash and calls the settor method for them. This is probably pretty inefficient and should likely be changed at some point.

[Source]

    # File lib/puppet/parser/ast.rb, line 69
69:     def initialize(args)
70:         @file = nil
71:         @line = nil
72:         set_options(args)
73:     end

Does this ast object set something? If so, it gets evaluated first.

[Source]

    # File lib/puppet/parser/ast.rb, line 18
18:     def self.settor?
19:         if defined? @settor
20:             @settor
21:         else
22:             false
23:         end
24:     end

Public Instance methods

Evaluate the current object. Just a stub method, since the subclass should override this method. of the contained children and evaluates them in turn, returning a list of all of the collected values, rejecting nil values

[Source]

    # File lib/puppet/parser/ast.rb, line 30
30:     def evaluate(*options)
31:         raise Puppet::DevError, "Did not override #evaluate in %s" % self.class
32:     end

Throw a parse error.

[Source]

    # File lib/puppet/parser/ast.rb, line 35
35:     def parsefail(message)
36:         self.fail(Puppet::ParseError, message)
37:     end

Wrap a statemp in a reusable way so we always throw a parse error.

[Source]

    # File lib/puppet/parser/ast.rb, line 40
40:     def parsewrap
41:         exceptwrap :type => Puppet::ParseError do
42:             yield
43:         end
44:     end

The version of the evaluate method that should be called, because it correctly handles errors. It is critical to use this method because it can enable you to catch the error where it happens, rather than much higher up the stack.

[Source]

    # File lib/puppet/parser/ast.rb, line 50
50:     def safeevaluate(*options)
51:         # We duplicate code here, rather than using exceptwrap, because this
52:         # is called so many times during parsing.
53:         begin
54:             return self.evaluate(*options)
55:         rescue Puppet::Error => detail
56:             raise adderrorcontext(detail)
57:         rescue => detail
58:             error = Puppet::Error.new(detail.to_s)
59:             # We can't use self.fail here because it always expects strings,
60:             # not exceptions.
61:             raise adderrorcontext(error, detail)
62:         end
63:     end

[Validate]