Class: Puppet::Bindings::NamedBindingsAdapter
- Inherits:
-
Pops::Adaptable::Adapter
- Object
- Pops::Adaptable::Adapter
- Puppet::Bindings::NamedBindingsAdapter
- Defined in:
- lib/puppet/bindings.rb
Overview
A NamedBindingsAdapter holds a map of name to Puppet::Pops::Binder::Bindings::NamedBindings. It is intended to be used as an association between an Environment and named bindings.
Constant Summary
Constants inherited from Pops::Adaptable::Adapter
Pops::Adaptable::Adapter::DOUBLE_COLON, Pops::Adaptable::Adapter::USCORE
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
- #each_pair(&block) ⇒ Object
- #has_name?(name) ⇒ Boolean
-
#initialize ⇒ NamedBindingsAdapter
constructor
A new instance of NamedBindingsAdapter.
Methods inherited from Pops::Adaptable::Adapter
adapt, adapt_new, associate_adapter, clear, create_adapter, get, instance_var_name, self_attr_name
Constructor Details
#initialize ⇒ NamedBindingsAdapter
Returns a new instance of NamedBindingsAdapter.
123 124 125 |
# File 'lib/puppet/bindings.rb', line 123 def initialize() @named_bindings = {} end |
Instance Method Details
#[](name) ⇒ Object
127 128 129 |
# File 'lib/puppet/bindings.rb', line 127 def [](name) @named_bindings[name] end |
#[]=(name, value) ⇒ Object
135 136 137 138 139 140 |
# File 'lib/puppet/bindings.rb', line 135 def []=(name, value) unless value.is_a?(Puppet::Pops::Binder::Bindings::NamedBindings) || value.is_a?(Proc) raise ArgumentError, "Given value must be a NamedBindings, or a Proc producing one, got: #{value.class}." end @named_bindings[name] = value end |
#each_pair(&block) ⇒ Object
142 143 144 |
# File 'lib/puppet/bindings.rb', line 142 def each_pair(&block) @named_bindings.each_pair(&block) end |
#has_name?(name) ⇒ Boolean
131 132 133 |
# File 'lib/puppet/bindings.rb', line 131 def has_name?(name) @named_bindings.has_key? end |