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

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2330 def _pcore_all_contents(path, &block)
2331   path << self
2332   unless @body.nil?
2333     block.call(@body, path)
2334     @body._pcore_all_contents(path, &block)
2335   end
2336   path.pop
2337 end
_pcore_contents() { |body| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
2326 def _pcore_contents
2327   yield(@body) unless @body.nil?
2328 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
2319 def _pcore_init_hash
2320   result = super
2321   result['parent'] = @parent unless @parent == nil
2322   result['body'] = @body unless @body == nil
2323   result
2324 end
eql?(o) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2339 def eql?(o)
2340   super &&
2341   @parent.eql?(o.parent) &&
2342   @body.eql?(o.body)
2343 end
Also aliased as: ==