Sha256: 4ee377be7d6bbef2465a7c5b6fc9ede820be595ec3012ebc6d5e57637e25fbca
Contents?: true
Size: 1.02 KB
Versions: 35
Compression:
Stored size: 1.02 KB
Contents
require "active_support/core_ext/module/delegation" module Rails class Application class RoutesReloader attr_reader :route_sets, :paths delegate :execute_if_updated, :execute, :updated?, to: :updater def initialize @paths = [] @route_sets = [] end def reload! clear! load_paths finalize! ensure revert end private def updater @updater ||= begin updater = ActiveSupport::FileUpdateChecker.new(paths) { reload! } updater.execute updater end end def clear! route_sets.each do |routes| routes.disable_clear_and_finalize = true routes.clear! end end def load_paths paths.each { |path| load(path) } end def finalize! route_sets.each(&:finalize!) end def revert route_sets.each do |routes| routes.disable_clear_and_finalize = false end end end end end
Version data entries
35 entries across 35 versions & 4 rubygems