class Puppet::Pops::Model::NodeDefinition

Attributes

body[R]
host_matches[R]
parent[R]

Public Class Methods

_pcore_type() click to toggle source
     # File lib/puppet/pops/model/ast.rb
2348 def self._pcore_type
2349   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::NodeDefinition', {
2350     'parent' => Definition._pcore_type,
2351     'attributes' => {
2352       'parent' => {
2353         'type' => Types::POptionalType.new(Expression._pcore_type),
2354         'value' => nil
2355       },
2356       'host_matches' => Types::PArrayType.new(Expression._pcore_type, Types::PCollectionType::NOT_EMPTY_SIZE),
2357       'body' => {
2358         'type' => Types::POptionalType.new(Expression._pcore_type),
2359         'value' => nil
2360       }
2361     }
2362   })
2363 end
create(locator, offset, length, host_matches, parent = nil, body = nil) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2379 def self.create(locator, offset, length, host_matches, parent = nil, body = nil)
2380   ta = Types::TypeAsserter
2381   attrs = _pcore_type.attributes(true)
2382   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
2383   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
2384   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
2385   ta.assert_instance_of('Puppet::AST::NodeDefinition[parent]', attrs['parent'].type, parent)
2386   ta.assert_instance_of('Puppet::AST::NodeDefinition[host_matches]', attrs['host_matches'].type, host_matches)
2387   ta.assert_instance_of('Puppet::AST::NodeDefinition[body]', attrs['body'].type, body)
2388   new(locator, offset, length, host_matches, parent, body)
2389 end
from_asserted_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2369 def self.from_asserted_hash(init_hash)
2370   new(
2371     init_hash['locator'],
2372     init_hash['offset'],
2373     init_hash['length'],
2374     init_hash['host_matches'],
2375     init_hash['parent'],
2376     init_hash['body'])
2377 end
from_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2365 def self.from_hash(init_hash)
2366   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::NodeDefinition initializer', _pcore_type.init_hash_type, init_hash))
2367 end
new(locator, offset, length, host_matches, parent = nil, body = nil) click to toggle source
Calls superclass method Puppet::Pops::Model::Positioned::new
     # File lib/puppet/pops/model/ast.rb
2395 def initialize(locator, offset, length, host_matches, parent = nil, body = nil)
2396   super(locator, offset, length)
2397   @hash = @hash ^ parent.hash ^ host_matches.hash ^ body.hash
2398   @parent = parent
2399   @host_matches = host_matches
2400   @body = body
2401 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2417 def _pcore_all_contents(path, &block)
2418   path << self
2419   unless @parent.nil?
2420     block.call(@parent, path)
2421     @parent._pcore_all_contents(path, &block)
2422   end
2423   @host_matches.each do |value|
2424     block.call(value, path)
2425     value._pcore_all_contents(path, &block)
2426   end
2427   unless @body.nil?
2428     block.call(@body, path)
2429     @body._pcore_all_contents(path, &block)
2430   end
2431   path.pop
2432 end
_pcore_contents() { |parent| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
2411 def _pcore_contents
2412   yield(@parent) unless @parent.nil?
2413   @host_matches.each { |value| yield(value) }
2414   yield(@body) unless @body.nil?
2415 end
_pcore_init_hash() click to toggle source
Calls superclass method Puppet::Pops::Model::Positioned#_pcore_init_hash
     # File lib/puppet/pops/model/ast.rb
2403 def _pcore_init_hash
2404   result = super
2405   result['parent'] = @parent unless @parent == nil
2406   result['host_matches'] = @host_matches
2407   result['body'] = @body unless @body == nil
2408   result
2409 end
eql?(o) click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject#eql?
     # File lib/puppet/pops/model/ast.rb
2434 def eql?(o)
2435   super &&
2436   @parent.eql?(o.parent) &&
2437   @host_matches.eql?(o.host_matches) &&
2438   @body.eql?(o.body)
2439 end
Also aliased as: ==