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?, #callable_with?, #check_self_recursion, #create, #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.
391
392
393
|
# File 'lib/puppet/pops/types/types.rb', line 391
def initialize(type)
@type = type
end
|
Instance Attribute Details
389
390
391
|
# File 'lib/puppet/pops/types/types.rb', line 389
def type
@type
end
|
Class Method Details
.register_ptype(loader, ir) ⇒ Object
385
386
387
|
# File 'lib/puppet/pops/types/types.rb', line 385
def self.register_ptype(loader, ir)
end
|
Instance Method Details
#accept(visitor, guard) ⇒ Object
395
396
397
398
|
# File 'lib/puppet/pops/types/types.rb', line 395
def accept(visitor, guard)
super
@type.accept(visitor, guard) unless @type.nil?
end
|
#eql?(o) ⇒ Boolean
422
423
424
|
# File 'lib/puppet/pops/types/types.rb', line 422
def eql?(o)
self.class == o.class && @type == o.type
end
|
#generalize ⇒ Object
400
401
402
403
404
405
406
407
|
# File 'lib/puppet/pops/types/types.rb', line 400
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
|
418
419
420
|
# File 'lib/puppet/pops/types/types.rb', line 418
def hash
self.class.hash ^ @type.hash
end
|
#normalize(guard = nil) ⇒ Object
409
410
411
412
413
414
415
416
|
# File 'lib/puppet/pops/types/types.rb', line 409
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
426
427
428
429
430
|
# File 'lib/puppet/pops/types/types.rb', line 426
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
|