Method: Puppet::Pops::Types::PNotUndefType#normalize

Defined in:
lib/puppet/pops/types/types.rb

#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.



567
568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/puppet/pops/types/types.rb', line 567

def normalize(guard = nil)
  n = super
  if n.type.nil?
    n
  elsif n.type.is_a?(POptionalType)
    PNotUndefType.new(n.type.type).normalize
  # No point in having an optional in a NotUndef
  elsif !n.type.assignable?(PUndefType::DEFAULT)
    # THe type is NotUndef anyway, so it can be stripped of
    n.type
  else
    n
  end
end