Module: Deterministic::PatternMatching

Included in:
Either
Defined in:
lib/deterministic/either/match.rb

Defined Under Namespace

Classes: Match, NoMatchError

Instance Method Summary collapse

Instance Method Details

#match(context = nil, &block) ⇒ Object



3
4
5
6
7
8
# File 'lib/deterministic/either/match.rb', line 3

def match(context=nil, &block)
  context ||= block.binding.eval('self')
  match = Match.new(self, context)
  match.instance_eval &block
  match.result
end