Sha256: e47d54b4f3e29a89c74a6f3a4ce58585d2f8346a7d5b2c8a8ca8c1291bb4846f
Contents?: true
Size: 1.06 KB
Versions: 126
Compression:
Stored size: 1.06 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 do |routes| routes.finalize! end end def revert route_sets.each do |routes| routes.disable_clear_and_finalize = false end end end end end
Version data entries
126 entries across 122 versions & 10 rubygems