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

Public Instance Methods

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