class ActionDispatch::Journey::Routes
:nodoc:
added to the table by calling Routes#add_route.
The Routing table. Contains all routes for a system. Routes can be
:nodoc:
def add_route(app, path, conditions, defaults, name = nil)
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 && !named_routes[name] clear_cache! route end
def ast
def ast @ast ||= begin asts = partitioned_routes.first.map(&:ast) Nodes::Or.new(asts) unless asts.empty? end end
def clear
def clear routes.clear named_routes.clear end
def clear_cache!
def clear_cache! @ast = nil @partitioned_routes = nil @simulator = nil end
def each(&block)
def each(&block) routes.each(&block) end
def empty?
def empty? routes.empty? end
def initialize
def initialize @routes = [] @named_routes = {} @ast = nil @partitioned_routes = nil @simulator = nil end
def last
def last routes.last end
def length
def length routes.length end
def partitioned_routes
def partitioned_routes @partitioned_routes ||= routes.partition do |r| r.path.anchored && r.ast.grep(Nodes::Symbol).all?(&:default_regexp?) end end
def simulator
def simulator @simulator ||= begin gtg = GTG::Builder.new(ast).transition_table GTG::Simulator.new(gtg) end end