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_failure, #on_success, #or, #some?, #type, #unwrap

Constructor Details

#initialize(value = nil) ⇒ None



145
146
147
# File 'lib/maybe.rb', line 145

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

Class Method Details

.[]Object



141
142
143
# File 'lib/maybe.rb', line 141

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

Instance Method Details

#deconstructObject



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

def deconstruct
  [nil]
end

#inspectObject



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

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

#mapObject



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

def map
  self
end

#to_sObject



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

def to_s
  'None'
end