Class: Puppet::Pops::Model::CapabilityMapping
- Inherits:
-
Definition
- Object
- PopsObject
- Positioned
- Expression
- Definition
- Puppet::Pops::Model::CapabilityMapping
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #capability ⇒ Object readonly
- #component ⇒ Object readonly
- #kind ⇒ Object readonly
- #mappings ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, kind, capability, component, mappings = _pcore_type['mappings'].value) ⇒ Object
- .from_asserted_hash(init_hash) ⇒ Object
- .from_hash(init_hash) ⇒ Object
Instance Method Summary collapse
- #_pcore_all_contents(path, &block) ⇒ Object
- #_pcore_contents {|@component| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, kind, capability, component, mappings = _pcore_type['mappings'].value) ⇒ CapabilityMapping
constructor
A new instance of CapabilityMapping.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, kind, capability, component, mappings = _pcore_type['mappings'].value) ⇒ CapabilityMapping
Returns a new instance of CapabilityMapping.
4213 4214 4215 4216 4217 4218 4219 4220 |
# File 'lib/puppet/pops/model/ast.rb', line 4213 def initialize(locator, offset, length, kind, capability, component, mappings = _pcore_type['mappings'].value) super(locator, offset, length) @hash = @hash ^ kind.hash ^ capability.hash ^ component.hash ^ mappings.hash @kind = kind @capability = capability @component = component @mappings = mappings end |
Instance Attribute Details
#capability ⇒ Object (readonly)
4209 4210 4211 |
# File 'lib/puppet/pops/model/ast.rb', line 4209 def capability @capability end |
#component ⇒ Object (readonly)
4210 4211 4212 |
# File 'lib/puppet/pops/model/ast.rb', line 4210 def component @component end |
#kind ⇒ Object (readonly)
4208 4209 4210 |
# File 'lib/puppet/pops/model/ast.rb', line 4208 def kind @kind end |
#mappings ⇒ Object (readonly)
4211 4212 4213 |
# File 'lib/puppet/pops/model/ast.rb', line 4211 def mappings @mappings end |
Class Method Details
._pcore_type ⇒ Object
4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 |
# File 'lib/puppet/pops/model/ast.rb', line 4165 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::CapabilityMapping', { 'parent' => Definition._pcore_type, 'attributes' => { 'kind' => Types::PStringType::DEFAULT, 'capability' => Types::PStringType::DEFAULT, 'component' => Expression._pcore_type, 'mappings' => { 'type' => Types::PArrayType.new(AbstractAttributeOperation._pcore_type), 'value' => [] } } }) end |
.create(locator, offset, length, kind, capability, component, mappings = _pcore_type['mappings'].value) ⇒ Object
4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 |
# File 'lib/puppet/pops/model/ast.rb', line 4195 def self.create(locator, offset, length, kind, capability, component, mappings = _pcore_type['mappings'].value) ta = Types::TypeAsserter attrs = _pcore_type.attributes(true) ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) ta.assert_instance_of('Puppet::AST::CapabilityMapping[kind]', attrs['kind'].type, kind) ta.assert_instance_of('Puppet::AST::CapabilityMapping[capability]', attrs['capability'].type, capability) ta.assert_instance_of('Puppet::AST::CapabilityMapping[component]', attrs['component'].type, component) ta.assert_instance_of('Puppet::AST::CapabilityMapping[mappings]', attrs['mappings'].type, mappings) new(locator, offset, length, kind, capability, component, mappings) end |
.from_asserted_hash(init_hash) ⇒ Object
4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 |
# File 'lib/puppet/pops/model/ast.rb', line 4184 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['kind'], init_hash['capability'], init_hash['component'], init_hash.fetch('mappings') { _pcore_type['mappings'].value }) end |
.from_hash(init_hash) ⇒ Object
4180 4181 4182 |
# File 'lib/puppet/pops/model/ast.rb', line 4180 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::CapabilityMapping initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 |
# File 'lib/puppet/pops/model/ast.rb', line 4236 def _pcore_all_contents(path, &block) path << self unless @component.nil? block.call(@component, path) @component._pcore_all_contents(path, &block) end @mappings.each do |value| block.call(value, path) value._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@component| ... } ⇒ Object
4231 4232 4233 4234 |
# File 'lib/puppet/pops/model/ast.rb', line 4231 def _pcore_contents yield(@component) unless @component.nil? @mappings.each { |value| yield(value) } end |
#_pcore_init_hash ⇒ Object
4222 4223 4224 4225 4226 4227 4228 4229 |
# File 'lib/puppet/pops/model/ast.rb', line 4222 def _pcore_init_hash result = super result['kind'] = @kind result['capability'] = @capability result['component'] = @component result['mappings'] = @mappings unless _pcore_type['mappings'].default_value?(@mappings) result end |
#eql?(o) ⇒ Boolean Also known as: ==
4249 4250 4251 4252 4253 4254 4255 |
# File 'lib/puppet/pops/model/ast.rb', line 4249 def eql?(o) super && @kind.eql?(o.kind) && @capability.eql?(o.capability) && @component.eql?(o.component) && @mappings.eql?(o.mappings) end |