Class: Puppet::Pops::Model::LiteralRegularExpression
- Inherits:
-
LiteralValue
- Object
- PopsObject
- Positioned
- Expression
- Literal
- LiteralValue
- Puppet::Pops::Model::LiteralRegularExpression
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #pattern ⇒ Object readonly
- #value ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, value, pattern) ⇒ 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, value, pattern) ⇒ LiteralRegularExpression
constructor
A new instance of LiteralRegularExpression.
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, value, pattern) ⇒ LiteralRegularExpression
Returns a new instance of LiteralRegularExpression.
3194 3195 3196 3197 3198 3199 |
# File 'lib/puppet/pops/model/ast.rb', line 3194 def initialize(locator, offset, length, value, pattern) super(locator, offset, length) @hash = @hash ^ value.hash ^ pattern.hash @value = value @pattern = pattern end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
3192 3193 3194 |
# File 'lib/puppet/pops/model/ast.rb', line 3192 def pattern @pattern end |
#value ⇒ Object (readonly)
3191 3192 3193 |
# File 'lib/puppet/pops/model/ast.rb', line 3191 def value @value end |
Class Method Details
._pcore_type ⇒ Object
3157 3158 3159 3160 3161 3162 3163 3164 3165 |
# File 'lib/puppet/pops/model/ast.rb', line 3157 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::LiteralRegularExpression', { 'parent' => LiteralValue._pcore_type, 'attributes' => { 'value' => Types::PAnyType::DEFAULT, 'pattern' => Types::PStringType::DEFAULT } }) end |
.create(locator, offset, length, value, pattern) ⇒ Object
3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 |
# File 'lib/puppet/pops/model/ast.rb', line 3180 def self.create(locator, offset, length, value, pattern) 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::LiteralRegularExpression[value]', attrs['value'].type, value) ta.assert_instance_of('Puppet::AST::LiteralRegularExpression[pattern]', attrs['pattern'].type, pattern) new(locator, offset, length, value, pattern) end |
.from_asserted_hash(init_hash) ⇒ Object
3171 3172 3173 3174 3175 3176 3177 3178 |
# File 'lib/puppet/pops/model/ast.rb', line 3171 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['value'], init_hash['pattern']) end |
.from_hash(init_hash) ⇒ Object
3167 3168 3169 |
# File 'lib/puppet/pops/model/ast.rb', line 3167 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::LiteralRegularExpression initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_init_hash ⇒ Object
3201 3202 3203 3204 3205 3206 |
# File 'lib/puppet/pops/model/ast.rb', line 3201 def _pcore_init_hash result = super result['value'] = @value result['pattern'] = @pattern result end |
#eql?(o) ⇒ Boolean Also known as: ==
3208 3209 3210 3211 3212 |
# File 'lib/puppet/pops/model/ast.rb', line 3208 def eql?(o) super && @value.eql?(o.value) && @pattern.eql?(o.pattern) end |