class Puppet::Pops::Model::ResourceExpression

Attributes

bodies[R]
type_name[R]

Public Class Methods

_pcore_type() click to toggle source
     # File lib/puppet/pops/model/ast.rb
4015 def self._pcore_type
4016   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::ResourceExpression', {
4017     'parent' => AbstractResource._pcore_type,
4018     'attributes' => {
4019       'type_name' => Expression._pcore_type,
4020       'bodies' => {
4021         'type' => Types::PArrayType.new(ResourceBody._pcore_type),
4022         'value' => []
4023       }
4024     }
4025   })
4026 end
create(locator, offset, length, type_name, form = "regular", bodies = _pcore_type['bodies'].value) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4042 def self.create(locator, offset, length, type_name, form = "regular", bodies = _pcore_type['bodies'].value)
4043   ta = Types::TypeAsserter
4044   attrs = _pcore_type.attributes(true)
4045   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
4046   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
4047   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
4048   ta.assert_instance_of('Puppet::AST::AbstractResource[form]', attrs['form'].type, form)
4049   ta.assert_instance_of('Puppet::AST::ResourceExpression[type_name]', attrs['type_name'].type, type_name)
4050   ta.assert_instance_of('Puppet::AST::ResourceExpression[bodies]', attrs['bodies'].type, bodies)
4051   new(locator, offset, length, type_name, form, bodies)
4052 end
from_asserted_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4032 def self.from_asserted_hash(init_hash)
4033   new(
4034     init_hash['locator'],
4035     init_hash['offset'],
4036     init_hash['length'],
4037     init_hash['type_name'],
4038     init_hash.fetch('form') { "regular" },
4039     init_hash.fetch('bodies') { _pcore_type['bodies'].value })
4040 end
from_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4028 def self.from_hash(init_hash)
4029   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::ResourceExpression initializer', _pcore_type.init_hash_type, init_hash))
4030 end
new(locator, offset, length, type_name, form = "regular", bodies = _pcore_type['bodies'].value) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4057 def initialize(locator, offset, length, type_name, form = "regular", bodies = _pcore_type['bodies'].value)
4058   super(locator, offset, length, form)
4059   @hash = @hash ^ type_name.hash ^ bodies.hash
4060   @type_name = type_name
4061   @bodies = bodies
4062 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4076 def _pcore_all_contents(path, &block)
4077   path << self
4078   unless @type_name.nil?
4079     block.call(@type_name, path)
4080     @type_name._pcore_all_contents(path, &block)
4081   end
4082   @bodies.each do |value|
4083     block.call(value, path)
4084     value._pcore_all_contents(path, &block)
4085   end
4086   path.pop
4087 end
_pcore_contents() { |type_name| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
4071 def _pcore_contents
4072   yield(@type_name) unless @type_name.nil?
4073   @bodies.each { |value| yield(value) }
4074 end
_pcore_init_hash() click to toggle source
Calls superclass method Puppet::Pops::Model::AbstractResource#_pcore_init_hash
     # File lib/puppet/pops/model/ast.rb
4064 def _pcore_init_hash
4065   result = super
4066   result['type_name'] = @type_name
4067   result['bodies'] = @bodies unless _pcore_type['bodies'].default_value?(@bodies)
4068   result
4069 end
eql?(o) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4089 def eql?(o)
4090   super &&
4091   @type_name.eql?(o.type_name) &&
4092   @bodies.eql?(o.bodies)
4093 end
Also aliased as: ==