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.
3726 3727 3728 3729 3730 3731 |
# File 'lib/puppet/pops/model/ast.rb', line 3726 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)
3724 3725 3726 |
# File 'lib/puppet/pops/model/ast.rb', line 3724 def future @future end |
#word ⇒ Object (readonly)
3723 3724 3725 |
# File 'lib/puppet/pops/model/ast.rb', line 3723 def word @word end |
Class Method Details
._pcore_type ⇒ Object
3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 |
# File 'lib/puppet/pops/model/ast.rb', line 3684 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
3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 |
# File 'lib/puppet/pops/model/ast.rb', line 3712 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
3703 3704 3705 3706 3707 3708 3709 3710 |
# File 'lib/puppet/pops/model/ast.rb', line 3703 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
3699 3700 3701 |
# File 'lib/puppet/pops/model/ast.rb', line 3699 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
3733 3734 3735 3736 3737 3738 |
# File 'lib/puppet/pops/model/ast.rb', line 3733 def _pcore_init_hash result = super result['word'] = @word result['future'] = @future unless @future == nil result end |
#eql?(o) ⇒ Boolean Also known as: ==
3740 3741 3742 3743 3744 |
# File 'lib/puppet/pops/model/ast.rb', line 3740 def eql?(o) super && @word.eql?(o.word) && @future.eql?(o.future) end |