Module: Mooset::Monad

Included in:
Many, Optional
Defined in:
lib/mooset/monads.rb

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
14
15
16
17
# File 'lib/mooset/monads.rb', line 9

def method_missing(*args, &block)
  within do |value|
    begin
      value.public_send(*args, &block)
    rescue
      require 'pry'; binding.pry
    end
  end
end

Instance Method Details

#within(&block) ⇒ Object



3
4
5
6
7
# File 'lib/mooset/monads.rb', line 3

def within(&block)
  and_then do |value|
    self.class.from_value(block.call(value))
  end
end