Class: Delivered::NilableType

Inherits:
Object
  • Object
show all
Defined in:
lib/delivered/types.rb

Instance Method Summary collapse

Constructor Details

#initialize(type = nil) ⇒ NilableType



80
81
82
# File 'lib/delivered/types.rb', line 80

def initialize(type = nil)
  @type = type
end

Instance Method Details

#===(value) ⇒ Object



86
87
88
# File 'lib/delivered/types.rb', line 86

def ===(value)
  (@type.nil? ? true : nil === value) || @type === value
end

#inspectObject



84
# File 'lib/delivered/types.rb', line 84

def inspect = "Nilable(#{@type&.inspect || 'Any'})"