class Puppet::Pops::Types::PNotUndefType
Constants
- DEFAULT
Public Class Methods
new(type = nil)
click to toggle source
Calls superclass method
Puppet::Pops::Types::PTypeWithContainedType::new
# File lib/puppet/pops/types/types.rb 558 def initialize(type = nil) 559 super(type.class == PAnyType ? nil : type) 560 end
register_ptype(loader, ir)
click to toggle source
# File lib/puppet/pops/types/types.rb 549 def self.register_ptype(loader, ir) 550 create_ptype(loader, ir, 'AnyType', 551 'type' => { 552 KEY_TYPE => POptionalType.new(PTypeType::DEFAULT), 553 KEY_VALUE => nil 554 } 555 ) 556 end
Public Instance Methods
instance?(o, guard = nil)
click to toggle source
# File lib/puppet/pops/types/types.rb 562 def instance?(o, guard = nil) 563 !(o.nil? || o == :undef) && (@type.nil? || @type.instance?(o, guard)) 564 end
new_function()
click to toggle source
# File lib/puppet/pops/types/types.rb 583 def new_function 584 # If only NotUndef, then use Unit's null converter 585 if type.nil? 586 PUnitType.new_function(self) 587 else 588 type.new_function 589 end 590 end
normalize(guard = nil)
click to toggle source
Calls superclass method
Puppet::Pops::Types::PTypeWithContainedType#normalize
# File lib/puppet/pops/types/types.rb 566 def normalize(guard = nil) 567 n = super 568 if n.type.nil? 569 n 570 else 571 if n.type.is_a?(POptionalType) 572 # No point in having an optional in a NotUndef 573 PNotUndefType.new(n.type.type).normalize 574 elsif !n.type.assignable?(PUndefType::DEFAULT) 575 # THe type is NotUndef anyway, so it can be stripped of 576 n.type 577 else 578 n 579 end 580 end 581 end
Protected Instance Methods
_assignable?(o, guard)
click to toggle source
@api private
# File lib/puppet/pops/types/types.rb 597 def _assignable?(o, guard) 598 o.is_a?(PAnyType) && !o.assignable?(PUndefType::DEFAULT, guard) && (@type.nil? || @type.assignable?(o, guard)) 599 end