class Puppet::Pops::Model::CaseExpression

Attributes

options[R]
test[R]

Public Class Methods

_pcore_type() click to toggle source
     # File lib/puppet/pops/model/ast.rb
1310 def self._pcore_type
1311   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::CaseExpression', {
1312     'parent' => Expression._pcore_type,
1313     'attributes' => {
1314       'test' => Expression._pcore_type,
1315       'options' => {
1316         'type' => Types::PArrayType.new(CaseOption._pcore_type),
1317         'value' => []
1318       }
1319     }
1320   })
1321 end
create(locator, offset, length, test, options = _pcore_type['options'].value) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1336 def self.create(locator, offset, length, test, options = _pcore_type['options'].value)
1337   ta = Types::TypeAsserter
1338   attrs = _pcore_type.attributes(true)
1339   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
1340   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
1341   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
1342   ta.assert_instance_of('Puppet::AST::CaseExpression[test]', attrs['test'].type, test)
1343   ta.assert_instance_of('Puppet::AST::CaseExpression[options]', attrs['options'].type, options)
1344   new(locator, offset, length, test, options)
1345 end
from_asserted_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1327 def self.from_asserted_hash(init_hash)
1328   new(
1329     init_hash['locator'],
1330     init_hash['offset'],
1331     init_hash['length'],
1332     init_hash['test'],
1333     init_hash.fetch('options') { _pcore_type['options'].value })
1334 end
from_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1323 def self.from_hash(init_hash)
1324   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::CaseExpression initializer', _pcore_type.init_hash_type, init_hash))
1325 end
new(locator, offset, length, test, options = _pcore_type['options'].value) click to toggle source
Calls superclass method Puppet::Pops::Model::Positioned::new
     # File lib/puppet/pops/model/ast.rb
1350 def initialize(locator, offset, length, test, options = _pcore_type['options'].value)
1351   super(locator, offset, length)
1352   @hash = @hash ^ test.hash ^ options.hash
1353   @test = test
1354   @options = options
1355 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1369 def _pcore_all_contents(path, &block)
1370   path << self
1371   unless @test.nil?
1372     block.call(@test, path)
1373     @test._pcore_all_contents(path, &block)
1374   end
1375   @options.each do |value|
1376     block.call(value, path)
1377     value._pcore_all_contents(path, &block)
1378   end
1379   path.pop
1380 end
_pcore_contents() { |test| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
1364 def _pcore_contents
1365   yield(@test) unless @test.nil?
1366   @options.each { |value| yield(value) }
1367 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
1357 def _pcore_init_hash
1358   result = super
1359   result['test'] = @test
1360   result['options'] = @options unless _pcore_type['options'].default_value?(@options)
1361   result
1362 end
eql?(o) click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject#eql?
     # File lib/puppet/pops/model/ast.rb
1382 def eql?(o)
1383   super &&
1384   @test.eql?(o.test) &&
1385   @options.eql?(o.options)
1386 end
Also aliased as: ==