Class: Puppet::Pops::Model::HeredocExpression
- Inherits:
-
Expression
- Object
- PopsObject
- Positioned
- Expression
- Puppet::Pops::Model::HeredocExpression
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #syntax ⇒ Object readonly
- #text_expr ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, text_expr, syntax = 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 {|@text_expr| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, text_expr, syntax = nil) ⇒ HeredocExpression
constructor
A new instance of HeredocExpression.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, text_expr, syntax = nil) ⇒ HeredocExpression
Returns a new instance of HeredocExpression.
2539 2540 2541 2542 2543 2544 |
# File 'lib/puppet/pops/model/ast.rb', line 2539 def initialize(locator, offset, length, text_expr, syntax = nil) super(locator, offset, length) @hash = @hash ^ syntax.hash ^ text_expr.hash @syntax = syntax @text_expr = text_expr end |
Instance Attribute Details
#syntax ⇒ Object (readonly)
2536 2537 2538 |
# File 'lib/puppet/pops/model/ast.rb', line 2536 def syntax @syntax end |
#text_expr ⇒ Object (readonly)
2537 2538 2539 |
# File 'lib/puppet/pops/model/ast.rb', line 2537 def text_expr @text_expr end |
Class Method Details
._pcore_type ⇒ Object
2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 |
# File 'lib/puppet/pops/model/ast.rb', line 2497 def self._pcore_type @_pcore_type ||= Types::PObjectType .new('Puppet::AST::HeredocExpression', { 'parent' => Expression._pcore_type, 'attributes' => { 'syntax' => { 'type' => Types::POptionalType.new(Types::PStringType::DEFAULT), 'value' => nil }, 'text_expr' => Expression._pcore_type } }) end |
.create(locator, offset, length, text_expr, syntax = nil) ⇒ Object
2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 |
# File 'lib/puppet/pops/model/ast.rb', line 2525 def self.create(locator, offset, length, text_expr, syntax = 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::HeredocExpression[syntax]', attrs['syntax'].type, syntax) ta.assert_instance_of('Puppet::AST::HeredocExpression[text_expr]', attrs['text_expr'].type, text_expr) new(locator, offset, length, text_expr, syntax) end |
.from_asserted_hash(init_hash) ⇒ Object
2516 2517 2518 2519 2520 2521 2522 2523 |
# File 'lib/puppet/pops/model/ast.rb', line 2516 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['text_expr'], init_hash['syntax']) end |
.from_hash(init_hash) ⇒ Object
2512 2513 2514 |
# File 'lib/puppet/pops/model/ast.rb', line 2512 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::HeredocExpression initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
2557 2558 2559 2560 2561 2562 2563 2564 |
# File 'lib/puppet/pops/model/ast.rb', line 2557 def _pcore_all_contents(path, &block) path << self unless @text_expr.nil? block.call(@text_expr, path) @text_expr._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@text_expr| ... } ⇒ Object
2553 2554 2555 |
# File 'lib/puppet/pops/model/ast.rb', line 2553 def _pcore_contents yield(@text_expr) unless @text_expr.nil? end |
#_pcore_init_hash ⇒ Object
2546 2547 2548 2549 2550 2551 |
# File 'lib/puppet/pops/model/ast.rb', line 2546 def _pcore_init_hash result = super result['syntax'] = @syntax unless @syntax == nil result['text_expr'] = @text_expr result end |
#eql?(o) ⇒ Boolean Also known as: ==
2566 2567 2568 2569 2570 |
# File 'lib/puppet/pops/model/ast.rb', line 2566 def eql?(o) super && @syntax.eql?(o.syntax) && @text_expr.eql?(o.text_expr) end |