Class: Puppet::Pops::Types::PTypeWithContainedType
Abstract
Overview
This class is abstract.
Encapsulates common behavior for a type that contains one type
Constant Summary
Constants inherited
from PAnyType
Puppet::Pops::Types::PAnyType::DEFAULT
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from PAnyType
#==, #assignable?, #callable?, #callable_args?, #check_self_recursion, #instance?, #iterable?, #iterable_type, #kind_of_callable?, #name, new_function, #new_function, #really_instance?, #simple_name, simple_name, #to_alias_expanded_s, #to_s
_ptype, create_ptype, register_ptypes
#_ptype
Constructor Details
Returns a new instance of PTypeWithContainedType.
378
379
380
|
# File 'lib/puppet/pops/types/types.rb', line 378
def initialize(type)
@type = type
end
|
Instance Attribute Details
376
377
378
|
# File 'lib/puppet/pops/types/types.rb', line 376
def type
@type
end
|
Class Method Details
.register_ptype(loader, ir) ⇒ Object
372
373
374
|
# File 'lib/puppet/pops/types/types.rb', line 372
def self.register_ptype(loader, ir)
end
|
Instance Method Details
#accept(visitor, guard) ⇒ Object
382
383
384
385
|
# File 'lib/puppet/pops/types/types.rb', line 382
def accept(visitor, guard)
super
@type.accept(visitor, guard) unless @type.nil?
end
|
#eql?(o) ⇒ Boolean
409
410
411
|
# File 'lib/puppet/pops/types/types.rb', line 409
def eql?(o)
self.class == o.class && @type == o.type
end
|
#generalize ⇒ Object
387
388
389
390
391
392
393
394
|
# File 'lib/puppet/pops/types/types.rb', line 387
def generalize
if @type.nil?
self.class::DEFAULT
else
ge_type = @type.generalize
@type.equal?(ge_type) ? self : self.class.new(ge_type)
end
end
|
405
406
407
|
# File 'lib/puppet/pops/types/types.rb', line 405
def hash
self.class.hash ^ @type.hash
end
|
#normalize(guard = nil) ⇒ Object
396
397
398
399
400
401
402
403
|
# File 'lib/puppet/pops/types/types.rb', line 396
def normalize(guard = nil)
if @type.nil?
self.class::DEFAULT
else
ne_type = @type.normalize(guard)
@type.equal?(ne_type) ? self : self.class.new(ne_type)
end
end
|
#resolve(type_parser, loader) ⇒ Object
413
414
415
416
417
|
# File 'lib/puppet/pops/types/types.rb', line 413
def resolve(type_parser, loader)
rtype = @type
rtype = rtype.resolve(type_parser, loader) unless rtype.nil?
rtype.equal?(@type) ? self : self.class.new(rtype)
end
|