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
4452 def self._pcore_type
4453   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::Program', {
4454     'parent' => PopsObject._pcore_type,
4455     'attributes' => {
4456       'body' => {
4457         'type' => Types::POptionalType.new(Expression._pcore_type),
4458         'value' => nil
4459       },
4460       'definitions' => {
4461         'type' => Types::PArrayType.new(Definition._pcore_type),
4462         'kind' => 'reference',
4463         'value' => []
4464       },
4465       'source_text' => {
4466         'type' => Types::PStringType::DEFAULT,
4467         'kind' => 'derived'
4468       },
4469       'source_ref' => {
4470         'type' => Types::PStringType::DEFAULT,
4471         'kind' => 'derived'
4472       },
4473       'line_offsets' => {
4474         'type' => Types::PArrayType.new(Types::PIntegerType::DEFAULT),
4475         'kind' => 'derived'
4476       },
4477       'locator' => Parser::Locator::Locator19._pcore_type
4478     }
4479   })
4480 end
create(locator, body = nil, definitions = _pcore_type['definitions'].value) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4493 def self.create(locator, body = nil, definitions = _pcore_type['definitions'].value)
4494   ta = Types::TypeAsserter
4495   attrs = _pcore_type.attributes(true)
4496   ta.assert_instance_of('Puppet::AST::Program[body]', attrs['body'].type, body)
4497   ta.assert_instance_of('Puppet::AST::Program[definitions]', attrs['definitions'].type, definitions)
4498   ta.assert_instance_of('Puppet::AST::Program[locator]', attrs['locator'].type, locator)
4499   new(locator, body, definitions)
4500 end
from_asserted_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4486 def self.from_asserted_hash(init_hash)
4487   new(
4488     init_hash['locator'],
4489     init_hash['body'],
4490     init_hash.fetch('definitions') { _pcore_type['definitions'].value })
4491 end
from_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4482 def self.from_hash(init_hash)
4483   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::Program initializer', _pcore_type.init_hash_type, init_hash))
4484 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
4522 def initialize(locator, body = nil, definitions = _pcore_type['definitions'].value)
4523   super()
4524   @hash = @hash ^ body.hash ^ definitions.hash ^ locator.hash
4525   @body = body
4526   @definitions = definitions
4527   @locator = locator
4528 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4543 def _pcore_all_contents(path, &block)
4544   path << self
4545   unless @body.nil?
4546     block.call(@body, path)
4547     @body._pcore_all_contents(path, &block)
4548   end
4549   unless @locator.nil?
4550     block.call(@locator, path)
4551     @locator._pcore_all_contents(path, &block)
4552   end
4553   path.pop
4554 end
_pcore_contents() { |body| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
4538 def _pcore_contents
4539   yield(@body) unless @body.nil?
4540   yield(@locator) unless @locator.nil?
4541 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
4530 def _pcore_init_hash
4531   result = super
4532   result['body'] = @body unless @body == nil
4533   result['definitions'] = @definitions unless _pcore_type['definitions'].default_value?(@definitions)
4534   result['locator'] = @locator
4535   result
4536 end
current() click to toggle source
     # File lib/puppet/pops/model/ast.rb
4506 def current
4507   self
4508 end
eql?(o) click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject#eql?
     # File lib/puppet/pops/model/ast.rb
4556 def eql?(o)
4557   super &&
4558   @body.eql?(o.body) &&
4559   @definitions.eql?(o.definitions) &&
4560   @locator.eql?(o.locator)
4561 end
Also aliased as: ==
line_offsets() click to toggle source
     # File lib/puppet/pops/model/ast.rb
4518 def line_offsets
4519   @locator.line_index
4520 end
source_ref() click to toggle source
     # File lib/puppet/pops/model/ast.rb
4514 def source_ref
4515   @locator.file
4516 end
source_text() click to toggle source
     # File lib/puppet/pops/model/ast.rb
4510 def source_text
4511   @locator.string
4512 end