Class: Monadic::Just
Overview
Represents an existing value
Defined Under Namespace
Classes: Proxy
Instance Method Summary collapse
-
#fetch(default = nil) ⇒ Object
(also: #_)
The underlying value.
- #method_missing(m, *args) ⇒ Object
-
#or(other) ⇒ Object
Always self for Just.
- #proxy ⇒ Object
Methods inherited from Maybe
#empty?, #select, #truly?, unit
Methods included from Monad
#==, #bind, #flat_map, #initialize, #join, #map, #to_ary, #to_s
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Method Details
#fetch(default = nil) ⇒ Object Also known as: _
Returns the underlying value.
38 39 40 |
# File 'lib/monadic/maybe.rb', line 38 def fetch(default=nil) @value end |
#or(other) ⇒ Object
Returns always self for Just.
66 67 68 |
# File 'lib/monadic/maybe.rb', line 66 def or(other) self end |