Class: Delivered::NilableType

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

Instance Method Summary collapse

Constructor Details

#initialize(type = nil) ⇒ NilableType

Returns a new instance of NilableType.



29
30
31
# File 'lib/delivered/types.rb', line 29

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

Instance Method Details

#===(value) ⇒ Object



35
36
37
# File 'lib/delivered/types.rb', line 35

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

#inspectObject



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

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