class Rails::Command::UnusedRoutesCommand

:nodoc:

def formatter

def formatter
  ActionDispatch::Routing::ConsoleFormatter::Unused.new
end

def inspector

def inspector
  ActionDispatch::Routing::RoutesInspector.new(routes)
end

def perform(*)

def perform(*)
  boot_application!
  require "action_dispatch/routing/inspector"
  say(inspector.format(formatter, routes_filter))
  exit(1) if routes.any?
end

def routes

def routes
  @routes ||= begin
    routes = Rails.application.routes.routes.select do |route|
      RouteInfo.new(route).unused?
    end
    ActionDispatch::Journey::Routes.new(routes)
  end
end

def routes_filter

def routes_filter
  options.symbolize_keys.slice(:controller, :grep)
end