Class: Puppet::Pops::Model::QueryExpression
- Inherits:
-
Expression
- Object
- PopsObject
- Positioned
- Expression
- Puppet::Pops::Model::QueryExpression
- Defined in:
- lib/puppet/pops/model/ast.rb
Direct Known Subclasses
Instance Attribute Summary collapse
- #expr ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, expr = nil) ⇒ Object
- .from_asserted_hash(init_hash) ⇒ Object
- .from_hash(init_hash) ⇒ Object
Instance Method Summary collapse
- #_pcore_all_contents(path, &block) ⇒ Object
- #_pcore_contents {|@expr| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, expr = nil) ⇒ QueryExpression
constructor
A new instance of QueryExpression.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, expr = nil) ⇒ QueryExpression
Returns a new instance of QueryExpression.
1457 1458 1459 1460 1461 |
# File 'lib/puppet/pops/model/ast.rb', line 1457 def initialize(locator, offset, length, expr = nil) super(locator, offset, length) @hash = @hash ^ expr.hash @expr = expr end |
Instance Attribute Details
#expr ⇒ Object (readonly)
1455 1456 1457 |
# File 'lib/puppet/pops/model/ast.rb', line 1455 def expr @expr end |
Class Method Details
._pcore_type ⇒ Object
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 |
# File 'lib/puppet/pops/model/ast.rb', line 1419 def self._pcore_type @_pcore_type ||= Types::PObjectType .new('Puppet::AST::QueryExpression', { 'parent' => Expression._pcore_type, 'attributes' => { 'expr' => { 'type' => Types::POptionalType.new(Expression._pcore_type), 'value' => nil } } }) end |
.create(locator, offset, length, expr = nil) ⇒ Object
1445 1446 1447 1448 1449 1450 1451 1452 1453 |
# File 'lib/puppet/pops/model/ast.rb', line 1445 def self.create(locator, offset, length, expr = 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::QueryExpression[expr]', attrs['expr'].type, expr) new(locator, offset, length, expr) end |
.from_asserted_hash(init_hash) ⇒ Object
1437 1438 1439 1440 1441 1442 1443 |
# File 'lib/puppet/pops/model/ast.rb', line 1437 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['expr']) end |
.from_hash(init_hash) ⇒ Object
1433 1434 1435 |
# File 'lib/puppet/pops/model/ast.rb', line 1433 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::QueryExpression initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
1473 1474 1475 1476 1477 1478 1479 1480 |
# File 'lib/puppet/pops/model/ast.rb', line 1473 def _pcore_all_contents(path, &block) path << self unless @expr.nil? block.call(@expr, path) @expr._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@expr| ... } ⇒ Object
1469 1470 1471 |
# File 'lib/puppet/pops/model/ast.rb', line 1469 def _pcore_contents yield(@expr) unless @expr.nil? end |
#_pcore_init_hash ⇒ Object
1463 1464 1465 1466 1467 |
# File 'lib/puppet/pops/model/ast.rb', line 1463 def _pcore_init_hash result = super result['expr'] = @expr unless @expr == nil result end |
#eql?(o) ⇒ Boolean Also known as: ==
1482 1483 1484 1485 |
# File 'lib/puppet/pops/model/ast.rb', line 1482 def eql?(o) super && @expr.eql?(o.expr) end |