summaryrefslogtreecommitdiff
path: root/lib/web/route_registry.rb
blob: 42a9c538bae718ddd799028249f3c38cfaa9fd2d (plain)
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