Class: Puppet::Context::EmptyStack Private
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
-
#bindings ⇒ Object
private
Return the bindings table, which is always empty here.
-
#lookup(name, &block) ⇒ Object
private
Lookup a binding.
-
#pop ⇒ Object
private
Base case of #pop always raises an error since this is the bottom.
-
#push(overrides, description = '') ⇒ Object
private
Push bindings onto the stack by creating a new Stack object with ‘self` as the parent.
Instance Method Details
#bindings ⇒ 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.
Return the bindings table, which is always empty here
136 137 138 |
# File 'lib/puppet/context.rb', line 136 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.
109 110 111 112 113 114 115 |
# File 'lib/puppet/context.rb', line 109 def lookup(name, &block) if block block.call else raise UndefinedBindingError, _("Unable to lookup '%{name}'") % { name: name } end end |
#pop ⇒ 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.
Base case of #pop always raises an error since this is the bottom
120 121 122 123 |
# File 'lib/puppet/context.rb', line 120 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
129 130 131 |
# File 'lib/puppet/context.rb', line 129 def push(overrides, description = '') Puppet::Context::Stack.new(self, overrides, description) end |