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

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4075 def _pcore_all_contents(path, &block)
4076   path << self
4077   unless @type_name.nil?
4078     block.call(@type_name, path)
4079     @type_name._pcore_all_contents(path, &block)
4080   end
4081   @bodies.each do |value|
4082     block.call(value, path)
4083     value._pcore_all_contents(path, &block)
4084   end
4085   path.pop
4086 end
_pcore_contents() { |type_name| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
4070 def _pcore_contents
4071   yield(@type_name) unless @type_name.nil?
4072   @bodies.each { |value| yield(value) }
4073 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
4063 def _pcore_init_hash
4064   result = super
4065   result['type_name'] = @type_name
4066   result['bodies'] = @bodies unless _pcore_type['bodies'].default_value?(@bodies)
4067   result
4068 end
eql?(o) click to toggle source
     # File lib/puppet/pops/model/ast.rb
4088 def eql?(o)
4089   super &&
4090   @type_name.eql?(o.type_name) &&
4091   @bodies.eql?(o.bodies)
4092 end
Also aliased as: ==