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.
3587 3588 3589 3590 3591 |
# File 'lib/puppet/pops/model/ast.rb', line 3587 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)
3585 3586 3587 |
# File 'lib/puppet/pops/model/ast.rb', line 3585 def segments @segments end |
Class Method Details
._pcore_type ⇒ Object
3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 |
# File 'lib/puppet/pops/model/ast.rb', line 3551 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
3575 3576 3577 3578 3579 3580 3581 3582 3583 |
# File 'lib/puppet/pops/model/ast.rb', line 3575 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
3567 3568 3569 3570 3571 3572 3573 |
# File 'lib/puppet/pops/model/ast.rb', line 3567 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
3563 3564 3565 |
# File 'lib/puppet/pops/model/ast.rb', line 3563 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
3603 3604 3605 3606 3607 3608 3609 3610 |
# File 'lib/puppet/pops/model/ast.rb', line 3603 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
3599 3600 3601 |
# File 'lib/puppet/pops/model/ast.rb', line 3599 def _pcore_contents @segments.each { |value| yield(value) } end |
#_pcore_init_hash ⇒ Object
3593 3594 3595 3596 3597 |
# File 'lib/puppet/pops/model/ast.rb', line 3593 def _pcore_init_hash result = super result['segments'] = @segments unless _pcore_type['segments'].default_value?(@segments) result end |
#eql?(o) ⇒ Boolean Also known as: ==
3612 3613 3614 3615 |
# File 'lib/puppet/pops/model/ast.rb', line 3612 def eql?(o) super && @segments.eql?(o.segments) end |