Class: Puppet::Pops::Types::PNotUndefType Private
- Inherits:
-
PTypeWithContainedType
- Object
- TypedModelObject
- PAnyType
- PTypeWithContainedType
- Puppet::Pops::Types::PNotUndefType
- Defined in:
- lib/puppet/pops/types/types.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- DEFAULT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
PNotUndefType.new
Instance Attribute Summary
Attributes inherited from PTypeWithContainedType
Instance Method Summary collapse
-
#initialize(type = nil) ⇒ PNotUndefType
constructor
private
A new instance of PNotUndefType.
- #instance?(o) ⇒ Boolean private
- #normalize(guard = nil) ⇒ Object private
Methods inherited from PTypeWithContainedType
#accept, #eql?, #generalize, #hash
Methods inherited from PAnyType
#==, #accept, #assignable?, #callable?, #callable_args?, #eql?, #generalize, #hash, #iterable?, #iterable_type, #kind_of_callable?, #simple_name, #to_alias_expanded_s, #to_s
Methods included from Visitable
Constructor Details
#initialize(type = nil) ⇒ PNotUndefType
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PNotUndefType.
397 398 399 |
# File 'lib/puppet/pops/types/types.rb', line 397 def initialize(type = nil) super(type.class == PAnyType ? nil : type) end |
Instance Method Details
#instance?(o) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
401 402 403 |
# File 'lib/puppet/pops/types/types.rb', line 401 def instance?(o) !(o.nil? || o == :undef) && (@type.nil? || @type.instance?(o)) end |
#normalize(guard = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/puppet/pops/types/types.rb', line 405 def normalize(guard = nil) n = super if n.type.nil? n else if n.type.is_a?(POptionalType) # No point in having an optional in a NotUndef PNotUndef.new(n.type.type).normalize elsif !n.type.assignable?(PUndefType::DEFAULT) # THe type is NotUndef anyway, so it can be stripped of n.type else n end end end |