Class: Monadic::Just

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

Instance Method Summary collapse

Methods inherited from Maybe

#empty?, #select, #to_ary, #truly?, unit

Methods inherited from Monad

#==, #bind, #initialize, #join, #map, #to_s, unit

Constructor Details

This class inherits a constructor from Monadic::Monad

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



41
42
43
# File 'lib/monadic/maybe.rb', line 41

def method_missing(m, *args)
  Maybe(@value.__send__(m, *args))
end

Instance Method Details

#fetch(default = nil) ⇒ Object Also known as: _



36
37
38
# File 'lib/monadic/maybe.rb', line 36

def fetch(default=nil)
  @value
end