Class: StrongRoutes::RouteMatcher

Inherits:
Regexp
  • Object
show all
Defined in:
lib/strong_routes/route_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(route) ⇒ RouteMatcher



3
4
5
6
7
8
9
10
11
12
# File 'lib/strong_routes/route_matcher.rb', line 3

def initialize(route)
  if route.is_a?(Regexp)
    super(route)
  else
    route = map_dynamic_segments(route)
    route = "/#{route}" unless route =~ /\A\//
    escaped_route = Regexp.escape(route)
    super(/\A#{route}/i)
  end
end