Class: Rack::Multiplexer::Routes
- Inherits:
-
Object
- Object
- Rack::Multiplexer::Routes
- Defined in:
- lib/rack/multiplexer.rb
Instance Method Summary collapse
- #<<(route) ⇒ Object
- #find(path) ⇒ Object
-
#initialize ⇒ Routes
constructor
A new instance of Routes.
Constructor Details
#initialize ⇒ Routes
Returns a new instance of Routes.
79 80 81 |
# File 'lib/rack/multiplexer.rb', line 79 def initialize @routes = [] end |
Instance Method Details
#<<(route) ⇒ Object
91 92 93 |
# File 'lib/rack/multiplexer.rb', line 91 def <<(route) @routes << route end |
#find(path) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/rack/multiplexer.rb', line 83 def find(path) if regexp === path @routes.size.times do |i| return @routes[i] if Regexp.last_match("_#{i}") end end end |