Class: Puppet::Pops::Model::AbstractResource
Instance Attribute Summary collapse
Attributes inherited from Positioned
#length, #locator, #offset
Attributes inherited from PopsObject
#hash
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Positioned
#file, #line, #pos
Methods inherited from PopsObject
#_pcore_all_contents, #_pcore_contents, #to_s
#_pcore_all_contents, #_pcore_contents, #_pcore_type
Constructor Details
#initialize(locator, offset, length, form = "regular") ⇒ AbstractResource
Returns a new instance of AbstractResource.
4062
4063
4064
4065
4066
|
# File 'lib/puppet/pops/model/ast.rb', line 4062
def initialize(locator, offset, length, form = "regular")
super(locator, offset, length)
@hash = @hash ^ form.hash
@form = form
end
|
Instance Attribute Details
4052
4053
4054
|
# File 'lib/puppet/pops/model/ast.rb', line 4052
def form
@form
end
|
Class Method Details
._pcore_type ⇒ Object
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
|
# File 'lib/puppet/pops/model/ast.rb', line 4010
def self._pcore_type
@_pcore_type ||= Types::PObjectType.new('Puppet::AST::AbstractResource', {
'parent' => Expression._pcore_type,
'attributes' => {
'form' => {
'type' => Types::PEnumType.new(['exported', 'regular', 'virtual']),
'value' => 'regular'
},
'virtual' => {
'type' => Types::PBooleanType::DEFAULT,
'kind' => 'derived'
},
'exported' => {
'type' => Types::PBooleanType::DEFAULT,
'kind' => 'derived'
}
}
})
end
|
.create(locator, offset, length, form = "regular") ⇒ Object
4042
4043
4044
4045
4046
4047
4048
4049
4050
|
# File 'lib/puppet/pops/model/ast.rb', line 4042
def self.create(locator, offset, length, form = "regular")
ta = Types::TypeAsserter
attrs = _pcore_type.attributes(true)
ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
ta.assert_instance_of('Puppet::AST::AbstractResource[form]', attrs['form'].type, form)
new(locator, offset, length, form)
end
|
.from_asserted_hash(init_hash) ⇒ Object
4034
4035
4036
4037
4038
4039
4040
|
# File 'lib/puppet/pops/model/ast.rb', line 4034
def self.from_asserted_hash(init_hash)
new(
init_hash['locator'],
init_hash['offset'],
init_hash['length'],
init_hash.fetch('form') { "regular" })
end
|
.from_hash(init_hash) ⇒ Object
4030
4031
4032
|
# File 'lib/puppet/pops/model/ast.rb', line 4030
def self.from_hash(init_hash)
from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::AbstractResource initializer', _pcore_type.init_hash_type, init_hash))
end
|
Instance Method Details
#_pcore_init_hash ⇒ Object
4068
4069
4070
4071
4072
|
# File 'lib/puppet/pops/model/ast.rb', line 4068
def _pcore_init_hash
result = super
result['form'] = @form unless @form == "regular"
result
end
|
#eql?(o) ⇒ Boolean
Also known as:
==
4074
4075
4076
4077
|
# File 'lib/puppet/pops/model/ast.rb', line 4074
def eql?(o)
super &&
@form.eql?(o.form)
end
|
4058
4059
4060
|
# File 'lib/puppet/pops/model/ast.rb', line 4058
def exported
@form == 'exported'
end
|
4054
4055
4056
|
# File 'lib/puppet/pops/model/ast.rb', line 4054
def virtual
@form == 'virtual' || @form == 'exported'
end
|