Module: Monads::Monad
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
9
10
11
12
13
|
# File 'lib/monads/monad.rb', line 9
def method_missing(*args, &block)
within do |value|
value.public_send(*args, &block)
end
end
|
Instance Method Details
#within(&block) ⇒ Object
3
4
5
6
7
|
# File 'lib/monads/monad.rb', line 3
def within(&block)
and_then do |value|
self.class.from_value(block.call(value))
end
end
|