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
Constructor Details
#initialize(locator, offset, length, word, future = nil) ⇒ ReservedWord
Returns a new instance of ReservedWord.
3713 3714 3715 3716 3717 3718 |
# File 'lib/puppet/pops/model/ast.rb', line 3713 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)
3711 3712 3713 |
# File 'lib/puppet/pops/model/ast.rb', line 3711 def future @future end |
#word ⇒ Object (readonly)
3710 3711 3712 |
# File 'lib/puppet/pops/model/ast.rb', line 3710 def word @word end |
Class Method Details
._pcore_type ⇒ Object
3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 |
# File 'lib/puppet/pops/model/ast.rb', line 3673 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
3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 |
# File 'lib/puppet/pops/model/ast.rb', line 3699 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
3690 3691 3692 3693 3694 3695 3696 3697 |
# File 'lib/puppet/pops/model/ast.rb', line 3690 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
3686 3687 3688 |
# File 'lib/puppet/pops/model/ast.rb', line 3686 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
3720 3721 3722 3723 3724 3725 |
# File 'lib/puppet/pops/model/ast.rb', line 3720 def _pcore_init_hash result = super result['word'] = @word result['future'] = @future unless @future == nil result end |
#eql?(o) ⇒ Boolean Also known as: ==
3727 3728 3729 3730 3731 |
# File 'lib/puppet/pops/model/ast.rb', line 3727 def eql?(o) super && @word.eql?(o.word) && @future.eql?(o.future) end |