Object
The Routing table. Contains all routes for a system. Routes can be added to the table by calling Routes#add_route
Add a route to the routing table.
# File lib/journey/routes.rb, line 58 def add_route app, path, conditions, defaults, name = nil route = Route.new(name, app, path, conditions, defaults) route.precedence = routes.length routes << route named_routes[name] = route if name clear_cache! route end
# File lib/journey/routes.rb, line 41 def ast return @ast if @ast return if partitioned_routes.first.empty? asts = partitioned_routes.first.map { |r| r.ast } @ast = Nodes::Or.new(asts) end
# File lib/journey/routes.rb, line 27 def each(&block) routes.each(&block) end
# File lib/journey/routes.rb, line 18 def length @routes.length end
# File lib/journey/routes.rb, line 35 def partitioned_routes @partitioned_routes ||= routes.partition { |r| r.path.anchored && r.ast.grep(Nodes::Symbol).all? { |n| n.default_regexp? } } end
Generated with the Darkfish Rdoc Generator 2.