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