module Deterministic::PatternMatching

Public Instance Methods

match(context=nil, &block) click to toggle source
# File lib/deterministic/match.rb, line 5
def match(context=nil, &block)
  context ||= block.binding.eval('self') # the instance containing the match block
  match = binding.eval('self.class::Match.new(self, context)') # the class defining the Match
  match.instance_eval &block
  match.call
end