Class: MaybeMonad::Monad
Instance Method Summary
collapse
Constructor Details
#initialize(just) ⇒ Monad
17
18
19
|
# File 'lib/maybe_monad.rb', line 17
def initialize(just)
@just = just
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/maybe_monad.rb', line 25
def method_missing(name, *args)
@just.nil? ? Monad.new(nil) : Monad.new(@just.__send__(name, *args))
end
|
Instance Method Details
21
22
23
|
# File 'lib/maybe_monad.rb', line 21
def just
@just
end
|