Method: Murlsh::Dispatch#dispatch

Defined in:
lib/murlsh/dispatch.rb

#dispatch(req) ⇒ Object

Figure out which method will handle request.



53
54
55
56
57
58
59
# File 'lib/murlsh/dispatch.rb', line 53

def dispatch(req)
  method_match = routes.find do |rule|
    rule[0].match("#{req.request_method} #{req.path}")
  end

  method_match ? method_match[1] : self.method(:not_found)
end