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.
4512 4513 4514 4515 4516 4517 |
# File 'lib/puppet/pops/model/ast.rb', line 4512 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)
4510 4511 4512 |
# File 'lib/puppet/pops/model/ast.rb', line 4510 def operations @operations end |
#resources ⇒ Object (readonly)
4509 4510 4511 |
# File 'lib/puppet/pops/model/ast.rb', line 4509 def resources @resources end |
Class Method Details
._pcore_type ⇒ Object
4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 |
# File 'lib/puppet/pops/model/ast.rb', line 4470 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
4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 |
# File 'lib/puppet/pops/model/ast.rb', line 4497 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
4487 4488 4489 4490 4491 4492 4493 4494 4495 |
# File 'lib/puppet/pops/model/ast.rb', line 4487 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
4483 4484 4485 |
# File 'lib/puppet/pops/model/ast.rb', line 4483 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
4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 |
# File 'lib/puppet/pops/model/ast.rb', line 4531 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
4526 4527 4528 4529 |
# File 'lib/puppet/pops/model/ast.rb', line 4526 def _pcore_contents yield(@resources) unless @resources.nil? @operations.each { |value| yield(value) } end |
#_pcore_init_hash ⇒ Object
4519 4520 4521 4522 4523 4524 |
# File 'lib/puppet/pops/model/ast.rb', line 4519 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: ==
4544 4545 4546 4547 4548 |
# File 'lib/puppet/pops/model/ast.rb', line 4544 def eql?(o) super && @resources.eql?(o.resources) && @operations.eql?(o.operations) end |