Class: Puppet::Pops::Model::ReservedWord
- Inherits:
-
LiteralValue
- Object
- PopsObject
- Positioned
- Expression
- Literal
- LiteralValue
- Puppet::Pops::Model::ReservedWord
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #future ⇒ Object readonly
- #word ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, word, future = nil) ⇒ Object
- .from_asserted_hash(init_hash) ⇒ Object
- .from_hash(init_hash) ⇒ Object
Instance Method Summary collapse
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, word, future = nil) ⇒ ReservedWord
constructor
A new instance of ReservedWord.
Methods inherited from Positioned
Methods inherited from PopsObject
#_pcore_all_contents, #_pcore_contents, #to_s
Methods included from Types::PuppetObject
#_pcore_all_contents, #_pcore_contents, #_pcore_type, #to_s
Constructor Details
#initialize(locator, offset, length, word, future = nil) ⇒ ReservedWord
Returns a new instance of ReservedWord.
3646 3647 3648 3649 3650 3651 |
# File 'lib/puppet/pops/model/ast.rb', line 3646 def initialize(locator, offset, length, word, future = nil) super(locator, offset, length) @hash = @hash ^ word.hash ^ future.hash @word = word @future = future end |
Instance Attribute Details
#future ⇒ Object (readonly)
3644 3645 3646 |
# File 'lib/puppet/pops/model/ast.rb', line 3644 def future @future end |
#word ⇒ Object (readonly)
3643 3644 3645 |
# File 'lib/puppet/pops/model/ast.rb', line 3643 def word @word end |
Class Method Details
._pcore_type ⇒ Object
3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 |
# File 'lib/puppet/pops/model/ast.rb', line 3606 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::ReservedWord', { 'parent' => LiteralValue._pcore_type, 'attributes' => { 'word' => Types::PStringType::DEFAULT, 'future' => { 'type' => Types::POptionalType.new(Types::PBooleanType::DEFAULT), 'value' => nil } } }) end |
.create(locator, offset, length, word, future = nil) ⇒ Object
3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 |
# File 'lib/puppet/pops/model/ast.rb', line 3632 def self.create(locator, offset, length, word, future = nil) 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::ReservedWord[word]', attrs['word'].type, word) ta.assert_instance_of('Puppet::AST::ReservedWord[future]', attrs['future'].type, future) new(locator, offset, length, word, future) end |
.from_asserted_hash(init_hash) ⇒ Object
3623 3624 3625 3626 3627 3628 3629 3630 |
# File 'lib/puppet/pops/model/ast.rb', line 3623 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['word'], init_hash['future']) end |
.from_hash(init_hash) ⇒ Object
3619 3620 3621 |
# File 'lib/puppet/pops/model/ast.rb', line 3619 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::ReservedWord initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_init_hash ⇒ Object
3653 3654 3655 3656 3657 3658 |
# File 'lib/puppet/pops/model/ast.rb', line 3653 def _pcore_init_hash result = super result['word'] = @word result['future'] = @future unless @future == nil result end |
#eql?(o) ⇒ Boolean Also known as: ==
3660 3661 3662 3663 3664 |
# File 'lib/puppet/pops/model/ast.rb', line 3660 def eql?(o) super && @word.eql?(o.word) && @future.eql?(o.future) end |