4 Result = Struct.new(:body)
8 attr_reader :path, :block
10 def initialize(path, &b)
16 Result.new(block.call)
26 @events = Hash.new { |hash, key| hash[key] = [] }
29 def define_event(method, path, &b)
30 events[method] << event = Event.new(path, &b)
34 def lookup(method, path)
35 events[method].find do |e|
36 result = e.invoke and break result