class Puppet::Pops::Model::CaseOption
Attributes
then_expr[R]
values[R]
Public Class Methods
_pcore_type()
click to toggle source
# File lib/puppet/pops/model/ast.rb 1229 def self._pcore_type 1230 @_pcore_type ||= Types::PObjectType.new('Puppet::AST::CaseOption', { 1231 'parent' => Expression._pcore_type, 1232 'attributes' => { 1233 'values' => Types::PArrayType.new(Expression._pcore_type, Types::PCollectionType::NOT_EMPTY_SIZE), 1234 'then_expr' => { 1235 'type' => Types::POptionalType.new(Expression._pcore_type), 1236 'value' => nil 1237 } 1238 } 1239 }) 1240 end
create(locator, offset, length, values, then_expr = nil)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1255 def self.create(locator, offset, length, values, then_expr = nil) 1256 ta = Types::TypeAsserter 1257 attrs = _pcore_type.attributes(true) 1258 ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) 1259 ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) 1260 ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) 1261 ta.assert_instance_of('Puppet::AST::CaseOption[values]', attrs['values'].type, values) 1262 ta.assert_instance_of('Puppet::AST::CaseOption[then_expr]', attrs['then_expr'].type, then_expr) 1263 new(locator, offset, length, values, then_expr) 1264 end
from_asserted_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1246 def self.from_asserted_hash(init_hash) 1247 new( 1248 init_hash['locator'], 1249 init_hash['offset'], 1250 init_hash['length'], 1251 init_hash['values'], 1252 init_hash['then_expr']) 1253 end
from_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1242 def self.from_hash(init_hash) 1243 from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::CaseOption initializer', _pcore_type.init_hash_type, init_hash)) 1244 end
new(locator, offset, length, values, then_expr = nil)
click to toggle source
Calls superclass method
Puppet::Pops::Model::Positioned::new
# File lib/puppet/pops/model/ast.rb 1269 def initialize(locator, offset, length, values, then_expr = nil) 1270 super(locator, offset, length) 1271 @hash = @hash ^ values.hash ^ then_expr.hash 1272 @values = values 1273 @then_expr = then_expr 1274 end
Public Instance Methods
_pcore_all_contents(path, &block)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1288 def _pcore_all_contents(path, &block) 1289 path << self 1290 @values.each do |value| 1291 block.call(value, path) 1292 value._pcore_all_contents(path, &block) 1293 end 1294 unless @then_expr.nil? 1295 block.call(@then_expr, path) 1296 @then_expr._pcore_all_contents(path, &block) 1297 end 1298 path.pop 1299 end
_pcore_contents() { |value| ... }
click to toggle source
# File lib/puppet/pops/model/ast.rb 1283 def _pcore_contents 1284 @values.each { |value| yield(value) } 1285 yield(@then_expr) unless @then_expr.nil? 1286 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 1276 def _pcore_init_hash 1277 result = super 1278 result['values'] = @values 1279 result['then_expr'] = @then_expr unless @then_expr == nil 1280 result 1281 end
eql?(o)
click to toggle source
Calls superclass method
Puppet::Pops::Model::PopsObject#eql?
# File lib/puppet/pops/model/ast.rb 1301 def eql?(o) 1302 super && 1303 @values.eql?(o.values) && 1304 @then_expr.eql?(o.then_expr) 1305 end
Also aliased as: ==