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.
4400 4401 4402 4403 4404 4405 |
# File 'lib/puppet/pops/model/ast.rb', line 4400 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)
4397 4398 4399 |
# File 'lib/puppet/pops/model/ast.rb', line 4397 def matching_expr @matching_expr end |
#value_expr ⇒ Object (readonly)
4398 4399 4400 |
# File 'lib/puppet/pops/model/ast.rb', line 4398 def value_expr @value_expr end |
Class Method Details
._pcore_type ⇒ Object
4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 |
# File 'lib/puppet/pops/model/ast.rb', line 4361 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
4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 |
# File 'lib/puppet/pops/model/ast.rb', line 4386 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
4377 4378 4379 4380 4381 4382 4383 4384 |
# File 'lib/puppet/pops/model/ast.rb', line 4377 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
4373 4374 4375 |
# File 'lib/puppet/pops/model/ast.rb', line 4373 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
4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 |
# File 'lib/puppet/pops/model/ast.rb', line 4419 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
4414 4415 4416 4417 |
# File 'lib/puppet/pops/model/ast.rb', line 4414 def _pcore_contents yield(@matching_expr) unless @matching_expr.nil? yield(@value_expr) unless @value_expr.nil? end |
#_pcore_init_hash ⇒ Object
4407 4408 4409 4410 4411 4412 |
# File 'lib/puppet/pops/model/ast.rb', line 4407 def _pcore_init_hash result = super result['matching_expr'] = @matching_expr result['value_expr'] = @value_expr result end |
#eql?(o) ⇒ Boolean Also known as: ==
4432 4433 4434 4435 4436 |
# File 'lib/puppet/pops/model/ast.rb', line 4432 def eql?(o) super && @matching_expr.eql?(o.matching_expr) && @value_expr.eql?(o.value_expr) end |