class Rails::Application::RoutesReloader
def clear!
def clear! route_sets.each do |routes| routes.disable_clear_and_finalize = true routes.clear! end end
def finalize!
def finalize! route_sets.each(&:finalize!) end
def initialize
def initialize @paths = [] @route_sets = [] @external_routes = [] @eager_load = false end
def load_paths
def load_paths paths.each { |path| load(path) } run_after_load_paths.call end
def reload!
def reload! clear! load_paths finalize! route_sets.each(&:eager_load!) if eager_load ensure revert end
def revert
def revert route_sets.each do |routes| routes.disable_clear_and_finalize = false end end
def run_after_load_paths
def run_after_load_paths @run_after_load_paths ||= -> { } end
def updater
def updater @updater ||= begin dirs = @external_routes.each_with_object({}) do |dir, hash| hash[dir.to_s] = %w(rb) end ActiveSupport::FileUpdateChecker.new(paths, dirs) { reload! } end end