Class: Puppet::Context::EmptyStack Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/context.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Base case for Puppet::Context::Stack.

Instance Method Summary collapse

Instance Method Details

#bindingsObject

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.

Return the bindings table, which is always empty here


134
135
136
# File 'lib/puppet/context.rb', line 134

def bindings
  {}
end

#lookup(name, &block) ⇒ 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.

Lookup a binding. Since there are none in EmptyStack, this always raises an exception unless a block is passed, in which case the block is called and its return value is used.


107
108
109
110
111
112
113
# File 'lib/puppet/context.rb', line 107

def lookup(name, &block)
  if block
    block.call
  else
    raise UndefinedBindingError, _("Unable to lookup '%{name}'") % { name: name }
  end
end

#popObject

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.

Base case of #pop always raises an error since this is the bottom

Raises:


118
119
120
121
# File 'lib/puppet/context.rb', line 118

def pop
  raise(StackUnderflow,
        _('Attempted to pop, but already at root of the context stack.'))
end

#push(overrides, description = '') ⇒ 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.

Push bindings onto the stack by creating a new Stack object with `self` as the parent


127
128
129
# File 'lib/puppet/context.rb', line 127

def push(overrides, description = '')
  Puppet::Context::Stack.new(self, overrides, description)
end