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

Methods

Included Modules

Puppet::Resource::TypeCollectionHelper Enumerable Puppet::Util::Errors

Classes and Modules

Class Puppet::Parser::Scope::Ephemeral

Constants

AST = Puppet::Parser::AST

Attributes

base  [RW] 
compiler  [RW] 
keyword  [RW] 
level  [RW] 
namespaces  [R] 
parent  [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.

Return the scope associated with a class. This is just here so that subclasses can set their parent scopes to be the scope of their parent class, and it‘s also used when looking up qualified variables.

Store the fact that we‘ve evaluated a class, and store a reference to the scope in which it was evaluated, so that we can look it up later.

Remove this when rebasing

is name an ephemeral variable?

check if name exists in one of the ephemeral scope.

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.

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?

remove ephemeral scope up to level

Undefine a variable; only used for testing.

[Validate]