Class: Maybe::None

Inherits:
Maybe
  • Object
show all
Defined in:
lib/maybe.rb

Constant Summary

Constants inherited from Maybe

IsBlank

Instance Attribute Summary

Attributes inherited from Maybe

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Maybe

#>, #>>, #apply!, #dig, #dig!, #fmap, #map!, #match, #none?, #of, of, #on, #on_failure, #on_success, #or, #some?, #type, #unwrap

Constructor Details

#initialize(value = nil) ⇒ None

Returns a new instance of None.



153
154
155
# File 'lib/maybe.rb', line 153

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

Class Method Details

.[]Object



149
150
151
# File 'lib/maybe.rb', line 149

def self.[](...)
  new(...)
end

Instance Method Details

#deconstructObject



157
158
159
# File 'lib/maybe.rb', line 157

def deconstruct
  [nil]
end

#inspectObject



161
162
163
# File 'lib/maybe.rb', line 161

def inspect
  format("#<Zx::Maybe::#{self}:0x%x value=%s>", object_id, @value.inspect)
end

#mapObject



169
170
171
# File 'lib/maybe.rb', line 169

def map
  self
end

#to_sObject



165
166
167
# File 'lib/maybe.rb', line 165

def to_s
  'None'
end