Class: Rack::Multiplexer::Routes

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/multiplexer.rb

Instance Method Summary collapse

Constructor Details

#initializeRoutes

Returns a new instance of Routes.



87
88
89
# File 'lib/rack/multiplexer.rb', line 87

def initialize
  @routes = []
end

Instance Method Details

#<<(route) ⇒ Object



99
100
101
# File 'lib/rack/multiplexer.rb', line 99

def <<(route)
  @routes << route
end

#find(path) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/rack/multiplexer.rb', line 91

def find(path)
  if regexp === path
    @routes.size.times do |i|
      return @routes[i] if Regexp.last_match("_#{i}")
    end
  end
end