Class: Puppet::Pops::Model::ResourceOverrideExpression
- Inherits:
-
AbstractResource
- Object
- PopsObject
- Positioned
- Expression
- AbstractResource
- Puppet::Pops::Model::ResourceOverrideExpression
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #operations ⇒ Object readonly
- #resources ⇒ Object readonly
Attributes inherited from AbstractResource
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].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 {|@resources| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) ⇒ ResourceOverrideExpression
constructor
A new instance of ResourceOverrideExpression.
Methods inherited from AbstractResource
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) ⇒ ResourceOverrideExpression
Returns a new instance of ResourceOverrideExpression.
4511 4512 4513 4514 4515 4516 |
# File 'lib/puppet/pops/model/ast.rb', line 4511 def initialize(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) super(locator, offset, length, form) @hash = @hash ^ resources.hash ^ operations.hash @resources = resources @operations = operations end |
Instance Attribute Details
#operations ⇒ Object (readonly)
4509 4510 4511 |
# File 'lib/puppet/pops/model/ast.rb', line 4509 def operations @operations end |
#resources ⇒ Object (readonly)
4508 4509 4510 |
# File 'lib/puppet/pops/model/ast.rb', line 4508 def resources @resources end |
Class Method Details
._pcore_type ⇒ Object
4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 |
# File 'lib/puppet/pops/model/ast.rb', line 4469 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::ResourceOverrideExpression', { 'parent' => AbstractResource._pcore_type, 'attributes' => { 'resources' => Expression._pcore_type, 'operations' => { 'type' => Types::PArrayType.new(AbstractAttributeOperation._pcore_type), 'value' => [] } } }) end |
.create(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) ⇒ Object
4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 |
# File 'lib/puppet/pops/model/ast.rb', line 4496 def self.create(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].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::AbstractResource[form]', attrs['form'].type, form) ta.assert_instance_of('Puppet::AST::ResourceOverrideExpression[resources]', attrs['resources'].type, resources) ta.assert_instance_of('Puppet::AST::ResourceOverrideExpression[operations]', attrs['operations'].type, operations) new(locator, offset, length, resources, form, operations) end |
.from_asserted_hash(init_hash) ⇒ Object
4486 4487 4488 4489 4490 4491 4492 4493 4494 |
# File 'lib/puppet/pops/model/ast.rb', line 4486 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['resources'], init_hash.fetch('form') { "regular" }, init_hash.fetch('operations') { _pcore_type['operations'].value }) end |
.from_hash(init_hash) ⇒ Object
4482 4483 4484 |
# File 'lib/puppet/pops/model/ast.rb', line 4482 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::ResourceOverrideExpression initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 |
# File 'lib/puppet/pops/model/ast.rb', line 4530 def _pcore_all_contents(path, &block) path << self unless @resources.nil? block.call(@resources, path) @resources._pcore_all_contents(path, &block) end @operations.each do |value| block.call(value, path) value._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@resources| ... } ⇒ Object
4525 4526 4527 4528 |
# File 'lib/puppet/pops/model/ast.rb', line 4525 def _pcore_contents yield(@resources) unless @resources.nil? @operations.each { |value| yield(value) } end |
#_pcore_init_hash ⇒ Object
4518 4519 4520 4521 4522 4523 |
# File 'lib/puppet/pops/model/ast.rb', line 4518 def _pcore_init_hash result = super result['resources'] = @resources result['operations'] = @operations unless _pcore_type['operations'].default_value?(@operations) result end |
#eql?(o) ⇒ Boolean Also known as: ==
4543 4544 4545 4546 4547 |
# File 'lib/puppet/pops/model/ast.rb', line 4543 def eql?(o) super && @resources.eql?(o.resources) && @operations.eql?(o.operations) end |