Class: Puppet::Pops::Model::SelectorEntry
- Inherits:
-
Positioned
- Object
- PopsObject
- Positioned
- Puppet::Pops::Model::SelectorEntry
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #matching_expr ⇒ Object readonly
- #value_expr ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, matching_expr, value_expr) ⇒ Object
- .from_asserted_hash(init_hash) ⇒ Object
- .from_hash(init_hash) ⇒ Object
Instance Method Summary collapse
- #_pcore_all_contents(path, &block) ⇒ Object
- #_pcore_contents {|@matching_expr| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, matching_expr, value_expr) ⇒ SelectorEntry
constructor
A new instance of SelectorEntry.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, matching_expr, value_expr) ⇒ SelectorEntry
Returns a new instance of SelectorEntry.
4466 4467 4468 4469 4470 4471 |
# File 'lib/puppet/pops/model/ast.rb', line 4466 def initialize(locator, offset, length, matching_expr, value_expr) super(locator, offset, length) @hash = @hash ^ matching_expr.hash ^ value_expr.hash @matching_expr = matching_expr @value_expr = value_expr end |
Instance Attribute Details
#matching_expr ⇒ Object (readonly)
4463 4464 4465 |
# File 'lib/puppet/pops/model/ast.rb', line 4463 def matching_expr @matching_expr end |
#value_expr ⇒ Object (readonly)
4464 4465 4466 |
# File 'lib/puppet/pops/model/ast.rb', line 4464 def value_expr @value_expr end |
Class Method Details
._pcore_type ⇒ Object
4429 4430 4431 4432 4433 4434 4435 4436 4437 |
# File 'lib/puppet/pops/model/ast.rb', line 4429 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::SelectorEntry', { 'parent' => Positioned._pcore_type, 'attributes' => { 'matching_expr' => Expression._pcore_type, 'value_expr' => Expression._pcore_type } }) end |
.create(locator, offset, length, matching_expr, value_expr) ⇒ Object
4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 |
# File 'lib/puppet/pops/model/ast.rb', line 4452 def self.create(locator, offset, length, matching_expr, value_expr) 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::SelectorEntry[matching_expr]', attrs['matching_expr'].type, matching_expr) ta.assert_instance_of('Puppet::AST::SelectorEntry[value_expr]', attrs['value_expr'].type, value_expr) new(locator, offset, length, matching_expr, value_expr) end |
.from_asserted_hash(init_hash) ⇒ Object
4443 4444 4445 4446 4447 4448 4449 4450 |
# File 'lib/puppet/pops/model/ast.rb', line 4443 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['matching_expr'], init_hash['value_expr']) end |
.from_hash(init_hash) ⇒ Object
4439 4440 4441 |
# File 'lib/puppet/pops/model/ast.rb', line 4439 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::SelectorEntry initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 |
# File 'lib/puppet/pops/model/ast.rb', line 4485 def _pcore_all_contents(path, &block) path << self unless @matching_expr.nil? block.call(@matching_expr, path) @matching_expr._pcore_all_contents(path, &block) end unless @value_expr.nil? block.call(@value_expr, path) @value_expr._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@matching_expr| ... } ⇒ Object
4480 4481 4482 4483 |
# File 'lib/puppet/pops/model/ast.rb', line 4480 def _pcore_contents yield(@matching_expr) unless @matching_expr.nil? yield(@value_expr) unless @value_expr.nil? end |
#_pcore_init_hash ⇒ Object
4473 4474 4475 4476 4477 4478 |
# File 'lib/puppet/pops/model/ast.rb', line 4473 def _pcore_init_hash result = super result['matching_expr'] = @matching_expr result['value_expr'] = @value_expr result end |
#eql?(o) ⇒ Boolean Also known as: ==
4498 4499 4500 4501 4502 |
# File 'lib/puppet/pops/model/ast.rb', line 4498 def eql?(o) super && @matching_expr.eql?(o.matching_expr) && @value_expr.eql?(o.value_expr) end |