Class: Maybe::None

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

Constant Summary

Constants inherited from Maybe

IsBlank

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Maybe

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

Constructor Details

#initialize(value = nil) ⇒ None

Returns a new instance of None.



143
144
145
# File 'lib/maybe.rb', line 143

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

Class Method Details

.[]Object



139
140
141
# File 'lib/maybe.rb', line 139

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

Instance Method Details

#deconstructObject



147
148
149
# File 'lib/maybe.rb', line 147

def deconstruct
  [nil]
end

#inspectObject



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

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

#mapObject



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

def map
  self
end

#to_sObject



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

def to_s
  'None'
end