class Puppet::Pops::Model::Program
Attributes
body[R]
definitions[R]
locator[R]
Public Class Methods
_pcore_type()
click to toggle source
# File lib/puppet/pops/model/ast.rb 4451 def self._pcore_type 4452 @_pcore_type ||= Types::PObjectType.new('Puppet::AST::Program', { 4453 'parent' => PopsObject._pcore_type, 4454 'attributes' => { 4455 'body' => { 4456 'type' => Types::POptionalType.new(Expression._pcore_type), 4457 'value' => nil 4458 }, 4459 'definitions' => { 4460 'type' => Types::PArrayType.new(Definition._pcore_type), 4461 'kind' => 'reference', 4462 'value' => [] 4463 }, 4464 'source_text' => { 4465 'type' => Types::PStringType::DEFAULT, 4466 'kind' => 'derived' 4467 }, 4468 'source_ref' => { 4469 'type' => Types::PStringType::DEFAULT, 4470 'kind' => 'derived' 4471 }, 4472 'line_offsets' => { 4473 'type' => Types::PArrayType.new(Types::PIntegerType::DEFAULT), 4474 'kind' => 'derived' 4475 }, 4476 'locator' => Parser::Locator::Locator19._pcore_type 4477 } 4478 }) 4479 end
create(locator, body = nil, definitions = _pcore_type['definitions'].value)
click to toggle source
# File lib/puppet/pops/model/ast.rb 4492 def self.create(locator, body = nil, definitions = _pcore_type['definitions'].value) 4493 ta = Types::TypeAsserter 4494 attrs = _pcore_type.attributes(true) 4495 ta.assert_instance_of('Puppet::AST::Program[body]', attrs['body'].type, body) 4496 ta.assert_instance_of('Puppet::AST::Program[definitions]', attrs['definitions'].type, definitions) 4497 ta.assert_instance_of('Puppet::AST::Program[locator]', attrs['locator'].type, locator) 4498 new(locator, body, definitions) 4499 end
from_asserted_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 4485 def self.from_asserted_hash(init_hash) 4486 new( 4487 init_hash['locator'], 4488 init_hash['body'], 4489 init_hash.fetch('definitions') { _pcore_type['definitions'].value }) 4490 end
from_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 4481 def self.from_hash(init_hash) 4482 from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::Program initializer', _pcore_type.init_hash_type, init_hash)) 4483 end
new(locator, body = nil, definitions = _pcore_type['definitions'].value)
click to toggle source
Calls superclass method
Puppet::Pops::Model::PopsObject::new
# File lib/puppet/pops/model/ast.rb 4521 def initialize(locator, body = nil, definitions = _pcore_type['definitions'].value) 4522 super() 4523 @hash = @hash ^ body.hash ^ definitions.hash ^ locator.hash 4524 @body = body 4525 @definitions = definitions 4526 @locator = locator 4527 end
Public Instance Methods
_pcore_all_contents(path, &block)
click to toggle source
# File lib/puppet/pops/model/ast.rb 4542 def _pcore_all_contents(path, &block) 4543 path << self 4544 unless @body.nil? 4545 block.call(@body, path) 4546 @body._pcore_all_contents(path, &block) 4547 end 4548 unless @locator.nil? 4549 block.call(@locator, path) 4550 @locator._pcore_all_contents(path, &block) 4551 end 4552 path.pop 4553 end
_pcore_contents() { |body| ... }
click to toggle source
# File lib/puppet/pops/model/ast.rb 4537 def _pcore_contents 4538 yield(@body) unless @body.nil? 4539 yield(@locator) unless @locator.nil? 4540 end
_pcore_init_hash()
click to toggle source
Calls superclass method
Puppet::Pops::Model::PopsObject#_pcore_init_hash
# File lib/puppet/pops/model/ast.rb 4529 def _pcore_init_hash 4530 result = super 4531 result['body'] = @body unless @body == nil 4532 result['definitions'] = @definitions unless _pcore_type['definitions'].default_value?(@definitions) 4533 result['locator'] = @locator 4534 result 4535 end
current()
click to toggle source
# File lib/puppet/pops/model/ast.rb 4505 def current 4506 self 4507 end
eql?(o)
click to toggle source
Calls superclass method
Puppet::Pops::Model::PopsObject#eql?
# File lib/puppet/pops/model/ast.rb 4555 def eql?(o) 4556 super && 4557 @body.eql?(o.body) && 4558 @definitions.eql?(o.definitions) && 4559 @locator.eql?(o.locator) 4560 end
Also aliased as: ==
line_offsets()
click to toggle source
# File lib/puppet/pops/model/ast.rb 4517 def line_offsets 4518 @locator.line_index 4519 end
source_ref()
click to toggle source
# File lib/puppet/pops/model/ast.rb 4513 def source_ref 4514 @locator.file 4515 end
source_text()
click to toggle source
# File lib/puppet/pops/model/ast.rb 4509 def source_text 4510 @locator.string 4511 end