Class: Zx::Maybe::None

Inherits:
Zx::Maybe show all
Defined in:
lib/zx/maybe.rb

Constant Summary

Constants inherited from Zx::Maybe

IsBlank

Instance Attribute Summary

Attributes inherited from Zx::Maybe

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Zx::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.



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

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

Class Method Details

.[]Object



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

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

Instance Method Details

#deconstructObject



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

def deconstruct
  [nil]
end

#inspectObject



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

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

#mapObject



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

def map
  self
end

#to_sObject



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

def to_s
  'None'
end