Class: Puppet::Pops::Model::ResourceOverrideExpression
- Inherits:
-
AbstractResource
- Object
- PopsObject
- Positioned
- Expression
- AbstractResource
- Puppet::Pops::Model::ResourceOverrideExpression
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #operations ⇒ Object readonly
- #resources ⇒ Object readonly
Attributes inherited from AbstractResource
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) ⇒ Object
- .from_asserted_hash(init_hash) ⇒ Object
- .from_hash(init_hash) ⇒ Object
Instance Method Summary collapse
- #_pcore_all_contents(path, &block) ⇒ Object
- #_pcore_contents {|@resources| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) ⇒ ResourceOverrideExpression
constructor
A new instance of ResourceOverrideExpression.
Methods inherited from AbstractResource
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) ⇒ ResourceOverrideExpression
Returns a new instance of ResourceOverrideExpression.
4320 4321 4322 4323 4324 4325 |
# File 'lib/puppet/pops/model/ast.rb', line 4320 def initialize(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) super(locator, offset, length, form) @hash = @hash ^ resources.hash ^ operations.hash @resources = resources @operations = operations end |
Instance Attribute Details
#operations ⇒ Object (readonly)
4318 4319 4320 |
# File 'lib/puppet/pops/model/ast.rb', line 4318 def operations @operations end |
#resources ⇒ Object (readonly)
4317 4318 4319 |
# File 'lib/puppet/pops/model/ast.rb', line 4317 def resources @resources end |
Class Method Details
._pcore_type ⇒ Object
4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 |
# File 'lib/puppet/pops/model/ast.rb', line 4276 def self._pcore_type @_pcore_type ||= Types::PObjectType .new('Puppet::AST::ResourceOverrideExpression', { 'parent' => AbstractResource._pcore_type, 'attributes' => { 'resources' => Expression._pcore_type, 'operations' => { 'type' => Types::PArrayType.new(AbstractAttributeOperation._pcore_type), 'value' => [] } } }) end |
.create(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) ⇒ Object
4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 |
# File 'lib/puppet/pops/model/ast.rb', line 4305 def self.create(locator, offset, length, resources, form = "regular", operations = _pcore_type['operations'].value) 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) ta.assert_instance_of('Puppet::AST::ResourceOverrideExpression[resources]', attrs['resources'].type, resources) ta.assert_instance_of('Puppet::AST::ResourceOverrideExpression[operations]', attrs['operations'].type, operations) new(locator, offset, length, resources, form, operations) end |
.from_asserted_hash(init_hash) ⇒ Object
4295 4296 4297 4298 4299 4300 4301 4302 4303 |
# File 'lib/puppet/pops/model/ast.rb', line 4295 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['resources'], init_hash.fetch('form') { "regular" }, init_hash.fetch('operations') { _pcore_type['operations'].value }) end |
.from_hash(init_hash) ⇒ Object
4291 4292 4293 |
# File 'lib/puppet/pops/model/ast.rb', line 4291 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::ResourceOverrideExpression initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 |
# File 'lib/puppet/pops/model/ast.rb', line 4339 def _pcore_all_contents(path, &block) path << self unless @resources.nil? block.call(@resources, path) @resources._pcore_all_contents(path, &block) end @operations.each do |value| block.call(value, path) value._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@resources| ... } ⇒ Object
4334 4335 4336 4337 |
# File 'lib/puppet/pops/model/ast.rb', line 4334 def _pcore_contents yield(@resources) unless @resources.nil? @operations.each { |value| yield(value) } end |
#_pcore_init_hash ⇒ Object
4327 4328 4329 4330 4331 4332 |
# File 'lib/puppet/pops/model/ast.rb', line 4327 def _pcore_init_hash result = super result['resources'] = @resources result['operations'] = @operations unless _pcore_type['operations'].default_value?(@operations) result end |
#eql?(o) ⇒ Boolean Also known as: ==
4352 4353 4354 4355 4356 |
# File 'lib/puppet/pops/model/ast.rb', line 4352 def eql?(o) super && @resources.eql?(o.resources) && @operations.eql?(o.operations) end |