class Puppet::Pops::Model::TypeDefinition

Attributes

body[R]
parent[R]

Public Class Methods

_pcore_type() click to toggle source
     # File lib/puppet/pops/model/ast.rb
2268 def self._pcore_type
2269   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::TypeDefinition', {
2270     'parent' => QRefDefinition._pcore_type,
2271     'attributes' => {
2272       'parent' => {
2273         'type' => Types::POptionalType.new(Types::PStringType::DEFAULT),
2274         'value' => nil
2275       },
2276       'body' => {
2277         'type' => Types::POptionalType.new(Expression._pcore_type),
2278         'value' => nil
2279       }
2280     }
2281   })
2282 end
create(locator, offset, length, name, parent = nil, body = nil) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2298 def self.create(locator, offset, length, name, parent = nil, body = nil)
2299   ta = Types::TypeAsserter
2300   attrs = _pcore_type.attributes(true)
2301   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
2302   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
2303   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
2304   ta.assert_instance_of('Puppet::AST::QRefDefinition[name]', attrs['name'].type, name)
2305   ta.assert_instance_of('Puppet::AST::TypeDefinition[parent]', attrs['parent'].type, parent)
2306   ta.assert_instance_of('Puppet::AST::TypeDefinition[body]', attrs['body'].type, body)
2307   new(locator, offset, length, name, parent, body)
2308 end
from_asserted_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2288 def self.from_asserted_hash(init_hash)
2289   new(
2290     init_hash['locator'],
2291     init_hash['offset'],
2292     init_hash['length'],
2293     init_hash['name'],
2294     init_hash['parent'],
2295     init_hash['body'])
2296 end
from_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2284 def self.from_hash(init_hash)
2285   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::TypeDefinition initializer', _pcore_type.init_hash_type, init_hash))
2286 end
new(locator, offset, length, name, parent = nil, body = nil) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2313 def initialize(locator, offset, length, name, parent = nil, body = nil)
2314   super(locator, offset, length, name)
2315   @hash = @hash ^ parent.hash ^ body.hash
2316   @parent = parent
2317   @body = body
2318 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2331 def _pcore_all_contents(path, &block)
2332   path << self
2333   unless @body.nil?
2334     block.call(@body, path)
2335     @body._pcore_all_contents(path, &block)
2336   end
2337   path.pop
2338 end
_pcore_contents() { |body| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
2327 def _pcore_contents
2328   yield(@body) unless @body.nil?
2329 end
_pcore_init_hash() click to toggle source
Calls superclass method Puppet::Pops::Model::QRefDefinition#_pcore_init_hash
     # File lib/puppet/pops/model/ast.rb
2320 def _pcore_init_hash
2321   result = super
2322   result['parent'] = @parent unless @parent == nil
2323   result['body'] = @body unless @body == nil
2324   result
2325 end
eql?(o) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2340 def eql?(o)
2341   super &&
2342   @parent.eql?(o.parent) &&
2343   @body.eql?(o.body)
2344 end
Also aliased as: ==