1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
require 'routed_command' module Booty class RouteRegistry def initialize(routes = []) @routes = routes end def register(route) @routes.push(route) end def route_for(request) @routes.find { |route| route.matches?(request) } end end end