class ActionDispatch::Journey::Routes

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/action_dispatch/journey/routes.rbs

class ActionDispatch::Journey::Routes
  def ast: () -> ActionDispatch::Journey::Nodes::Or
  def simulator: () -> ActionDispatch::Journey::GTG::Simulator
end

: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(name, mapping)

def add_route(name, mapping)
  route = mapping.make_route name, routes.length
  routes << route
  partition_route(route)
  clear_cache!
  route
end

def ast

Experimental RBS support (using type sampling data from the type_fusion project).

def ast: () -> ActionDispatch::Journey::Nodes::Or

This signature was generated using 2 samples from 1 application.

def ast
  @ast ||= begin
    nodes = anchored_routes.map(&:ast)
    Nodes::Or.new(nodes)
  end
end

def clear

def clear
  routes.clear
  anchored_routes.clear
  custom_routes.clear
end

def clear_cache!

def clear_cache!
  @ast                = 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             = []
  @ast                = nil
  @anchored_routes    = []
  @custom_routes      = []
  @simulator          = nil
end

def last

def last
  routes.last
end

def length

def length
  routes.length
end

def partition_route(route)

def partition_route(route)
  if route.path.anchored && route.path.requirements_anchored?
    anchored_routes << route
  else
    custom_routes << route
  end
end

def simulator

Experimental RBS support (using type sampling data from the type_fusion project).

def simulator: () -> ActionDispatch::Journey::GTG::Simulator

This signature was generated using 1 sample from 1 application.

def simulator
  @simulator ||= begin
    gtg = GTG::Builder.new(ast).transition_table
    GTG::Simulator.new(gtg)
  end
end