class ActionDispatch::Routing::RoutesInspector
:nodoc:
People should not use this class.
executes ‘rake routes` or looks at the RoutingError page.
This class is just used for displaying route information when someone
#
def collect_engine_routes(route)
def collect_engine_routes(route) name = route.endpoint return unless route.engine? return if @engines[name] routes = route.rack_app.routes if routes.is_a?(ActionDispatch::Routing::RouteSet) @engines[name] = collect_routes(routes.routes) end end
def collect_routes(routes)
def collect_routes(routes) routes.collect do |route| RouteWrapper.new(route) end.reject do |route| route.internal? end.collect do |route| collect_engine_routes(route) { name: route.name, verb: route.verb, path: route.path, reqs: route.reqs, regexp: route.json_regexp } end end
def filter_routes(filter)
def filter_routes(filter) if filter @routes.select { |route| route.defaults[:controller] == filter } else @routes end end
def format(formatter, filter = nil)
def format(formatter, filter = nil) routes_to_display = filter_routes(filter) routes = collect_routes(routes_to_display) if routes.none? formatter.no_routes return formatter.result end formatter.header routes formatter.section routes @engines.each do |name, engine_routes| formatter.section_title "Routes for #{name}" formatter.section engine_routes end formatter.result end
def initialize(routes)
People should not use this class.
executes `rake routes` or looks at the RoutingError page.
This class is just used for displaying route information when someone
#
def initialize(routes) @engines = {} @routes = routes end