Class: Puppet::Pops::Model::ConcatenatedString
- Inherits:
-
Expression
- Object
- PopsObject
- Positioned
- Expression
- Puppet::Pops::Model::ConcatenatedString
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #segments ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, segments = _pcore_type['segments'].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 ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, segments = _pcore_type['segments'].value) ⇒ ConcatenatedString
constructor
A new instance of ConcatenatedString.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, segments = _pcore_type['segments'].value) ⇒ ConcatenatedString
Returns a new instance of ConcatenatedString.
3520 3521 3522 3523 3524 |
# File 'lib/puppet/pops/model/ast.rb', line 3520 def initialize(locator, offset, length, segments = _pcore_type['segments'].value) super(locator, offset, length) @hash = @hash ^ segments.hash @segments = segments end |
Instance Attribute Details
#segments ⇒ Object (readonly)
3518 3519 3520 |
# File 'lib/puppet/pops/model/ast.rb', line 3518 def segments @segments end |
Class Method Details
._pcore_type ⇒ Object
3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 |
# File 'lib/puppet/pops/model/ast.rb', line 3484 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::ConcatenatedString', { 'parent' => Expression._pcore_type, 'attributes' => { 'segments' => { 'type' => Types::PArrayType.new(Expression._pcore_type), 'value' => [] } } }) end |
.create(locator, offset, length, segments = _pcore_type['segments'].value) ⇒ Object
3508 3509 3510 3511 3512 3513 3514 3515 3516 |
# File 'lib/puppet/pops/model/ast.rb', line 3508 def self.create(locator, offset, length, segments = _pcore_type['segments'].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::ConcatenatedString[segments]', attrs['segments'].type, segments) new(locator, offset, length, segments) end |
.from_asserted_hash(init_hash) ⇒ Object
3500 3501 3502 3503 3504 3505 3506 |
# File 'lib/puppet/pops/model/ast.rb', line 3500 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash.fetch('segments') { _pcore_type['segments'].value }) end |
.from_hash(init_hash) ⇒ Object
3496 3497 3498 |
# File 'lib/puppet/pops/model/ast.rb', line 3496 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::ConcatenatedString initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
3536 3537 3538 3539 3540 3541 3542 3543 |
# File 'lib/puppet/pops/model/ast.rb', line 3536 def _pcore_all_contents(path, &block) path << self @segments.each do |value| block.call(value, path) value._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents ⇒ Object
3532 3533 3534 |
# File 'lib/puppet/pops/model/ast.rb', line 3532 def _pcore_contents @segments.each { |value| yield(value) } end |
#_pcore_init_hash ⇒ Object
3526 3527 3528 3529 3530 |
# File 'lib/puppet/pops/model/ast.rb', line 3526 def _pcore_init_hash result = super result['segments'] = @segments unless _pcore_type['segments'].default_value?(@segments) result end |
#eql?(o) ⇒ Boolean Also known as: ==
3545 3546 3547 3548 |
# File 'lib/puppet/pops/model/ast.rb', line 3545 def eql?(o) super && @segments.eql?(o.segments) end |