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.



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