Class: Puppet::Pops::Model::SubLocatedExpression
- Inherits:
-
Expression
- Object
- PopsObject
- Positioned
- Expression
- Puppet::Pops::Model::SubLocatedExpression
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #expr ⇒ Object readonly
- #leading_line_count ⇒ Object readonly
- #leading_line_offset ⇒ Object readonly
- #line_offsets ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, expr, line_offsets = _pcore_type['line_offsets'].value, leading_line_count = nil, leading_line_offset = 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, line_offsets = _pcore_type['line_offsets'].value, leading_line_count = nil, leading_line_offset = nil) ⇒ SubLocatedExpression
constructor
A new instance of SubLocatedExpression.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, expr, line_offsets = _pcore_type['line_offsets'].value, leading_line_count = nil, leading_line_offset = nil) ⇒ SubLocatedExpression
Returns a new instance of SubLocatedExpression.
2593 2594 2595 2596 2597 2598 2599 2600 |
# File 'lib/puppet/pops/model/ast.rb', line 2593 def initialize(locator, offset, length, expr, line_offsets = _pcore_type['line_offsets'].value, leading_line_count = nil, leading_line_offset = nil) super(locator, offset, length) @hash = @hash ^ expr.hash ^ line_offsets.hash ^ leading_line_count.hash ^ leading_line_offset.hash @expr = expr @line_offsets = line_offsets @leading_line_count = leading_line_count @leading_line_offset = leading_line_offset end |
Instance Attribute Details
#expr ⇒ Object (readonly)
2588 2589 2590 |
# File 'lib/puppet/pops/model/ast.rb', line 2588 def expr @expr end |
#leading_line_count ⇒ Object (readonly)
2590 2591 2592 |
# File 'lib/puppet/pops/model/ast.rb', line 2590 def leading_line_count @leading_line_count end |
#leading_line_offset ⇒ Object (readonly)
2591 2592 2593 |
# File 'lib/puppet/pops/model/ast.rb', line 2591 def leading_line_offset @leading_line_offset end |
#line_offsets ⇒ Object (readonly)
2589 2590 2591 |
# File 'lib/puppet/pops/model/ast.rb', line 2589 def line_offsets @line_offsets end |
Class Method Details
._pcore_type ⇒ Object
2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 |
# File 'lib/puppet/pops/model/ast.rb', line 2539 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::SubLocatedExpression', { 'parent' => Expression._pcore_type, 'attributes' => { 'expr' => Expression._pcore_type, 'line_offsets' => { 'type' => Types::PArrayType.new(Types::PIntegerType::DEFAULT), 'value' => [] }, 'leading_line_count' => { 'type' => Types::POptionalType.new(Types::PIntegerType::DEFAULT), 'value' => nil }, 'leading_line_offset' => { 'type' => Types::POptionalType.new(Types::PIntegerType::DEFAULT), 'value' => nil } } }) end |
.create(locator, offset, length, expr, line_offsets = _pcore_type['line_offsets'].value, leading_line_count = nil, leading_line_offset = nil) ⇒ Object
2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 |
# File 'lib/puppet/pops/model/ast.rb', line 2575 def self.create(locator, offset, length, expr, line_offsets = _pcore_type['line_offsets'].value, leading_line_count = nil, leading_line_offset = 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::SubLocatedExpression[expr]', attrs['expr'].type, expr) ta.assert_instance_of('Puppet::AST::SubLocatedExpression[line_offsets]', attrs['line_offsets'].type, line_offsets) ta.assert_instance_of('Puppet::AST::SubLocatedExpression[leading_line_count]', attrs['leading_line_count'].type, leading_line_count) ta.assert_instance_of('Puppet::AST::SubLocatedExpression[leading_line_offset]', attrs['leading_line_offset'].type, leading_line_offset) new(locator, offset, length, expr, line_offsets, leading_line_count, leading_line_offset) end |
.from_asserted_hash(init_hash) ⇒ Object
2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 |
# File 'lib/puppet/pops/model/ast.rb', line 2564 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['expr'], init_hash.fetch('line_offsets') { _pcore_type['line_offsets'].value }, init_hash['leading_line_count'], init_hash['leading_line_offset']) end |
.from_hash(init_hash) ⇒ Object
2560 2561 2562 |
# File 'lib/puppet/pops/model/ast.rb', line 2560 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::SubLocatedExpression initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
2615 2616 2617 2618 2619 2620 2621 2622 |
# File 'lib/puppet/pops/model/ast.rb', line 2615 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
2611 2612 2613 |
# File 'lib/puppet/pops/model/ast.rb', line 2611 def _pcore_contents yield(@expr) unless @expr.nil? end |
#_pcore_init_hash ⇒ Object
2602 2603 2604 2605 2606 2607 2608 2609 |
# File 'lib/puppet/pops/model/ast.rb', line 2602 def _pcore_init_hash result = super result['expr'] = @expr result['line_offsets'] = @line_offsets unless _pcore_type['line_offsets'].default_value?(@line_offsets) result['leading_line_count'] = @leading_line_count unless @leading_line_count == nil result['leading_line_offset'] = @leading_line_offset unless @leading_line_offset == nil result end |
#eql?(o) ⇒ Boolean Also known as: ==
2624 2625 2626 2627 2628 2629 2630 |
# File 'lib/puppet/pops/model/ast.rb', line 2624 def eql?(o) super && @expr.eql?(o.expr) && @line_offsets.eql?(o.line_offsets) && @leading_line_count.eql?(o.leading_line_count) && @leading_line_offset.eql?(o.leading_line_offset) end |