Class Puppet::Parser::Scope
In: lib/puppet/parser/scope.rb
Parent: Object

Methods

Included Modules

Enumerable Puppet::Util::Errors

Constants

AST = Puppet::Parser::AST

Attributes

base  [RW] 
compiler  [RW] 
keyword  [RW] 
level  [RW] 
nodescope  [RW] 
parent  [W] 
parser  [RW] 
resource  [RW] 
source  [RW] 
top  [RW] 
translated  [RW] 

Public Class methods

Initialize our new scope. Defaults to having no parent.

Is the value a number?, return the correct object or nil if not a number

Is the value true? This allows us to control the definition of truth in one place.

Public Instance methods

Add to our list of namespaces.

A demeterific shortcut to the catalog.

Proxy accessors

Collect all of the defaults set at any higher scopes. This is a different type of lookup because it‘s additive — it collects all of the defaults, with defaults in closer scopes overriding those in later scopes.

Look up a defined type.

Look up a variable. The simplest value search we do. Default to returning an empty string for missing values, but support returning a constant.

Create a new scope and set these options.

Is this class for a node? This is used to make sure that nodes and classes with the same name conflict (620), which is required because of how often the names are used throughout the system, including on the client.

We probably shouldn‘t cache this value… But it‘s a lot faster than doing lots of queries.

Return the list of scopes up to the top scope, ordered with our own first. This is used for looking up variables and defaults.

Set defaults for a type. The typename should already be downcased, so that the syntax is isolated. We don‘t do any kind of type-checking here; instead we let the resource do it when the defaults are used.

Set a variable in the current scope. This will override settings in scopes above, but will not allow variables in the current scope to be reassigned.

Return an interpolated string.

Return the tags associated with this scope. It‘s basically just our parents’ tags, plus our type. We don‘t cache this value because our parent tags might change between calls.

Return a hash containing our variables and their values, optionally (and by default) including the values defined in our parent. Local values shadow parent values.

Used mainly for logging

Are we the top scope?

Undefine a variable; only used for testing.

[Validate]