From 27262897c704646305676acb37a7895fc4b99167 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Wed, 18 Aug 2021 22:31:07 +0200 Subject: [PATCH] Delete AS::Dependencies::Loadable --- .../lib/active_support/dependencies.rb | 69 ------------------- 1 file changed, 69 deletions(-) diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 1a873d3544d..a1fbf00f8ae 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -181,75 +181,6 @@ module ActiveSupport # :nodoc: # An internal stack used to record which constants are loaded by any block. mattr_accessor :constant_watch_stack, default: WatchStack.new - # Object includes this module. - module Loadable # :nodoc: - def self.exclude_from(base) - base.class_eval do - define_method(:load, Kernel.instance_method(:load)) - private :load - - define_method(:require, Kernel.instance_method(:require)) - private :require - end - end - - def self.include_into(base) - base.include(self) - - if base.instance_method(:load).owner == base - base.remove_method(:load) - end - - if base.instance_method(:require).owner == base - base.remove_method(:require) - end - end - - def require_or_load(file_name) - Dependencies.require_or_load(file_name) - end - - def load_dependency(file) - if Dependencies.load? && Dependencies.constant_watch_stack.watching? - descs = Dependencies.constant_watch_stack.watching.flatten.uniq - - Dependencies.new_constants_in(*descs) { yield } - else - yield - end - end - - # Mark the given constant as unloadable. Unloadable constants are removed - # each time dependencies are cleared. - # - # Note that marking a constant for unloading need only be done once. Setup - # or init scripts may list each unloadable constant that may need unloading; - # each constant will be removed for every subsequent clear, as opposed to - # for the first clear. - # - # The provided constant descriptor may be a (non-anonymous) module or class, - # or a qualified constant name as a string or symbol. - # - # Returns +true+ if the constant was not previously marked for unloading, - # +false+ otherwise. - def unloadable(const_desc) - Dependencies.mark_for_unload const_desc - end - - private - def load(file, wrap = false) - result = false - load_dependency(file) { result = super } - result - end - - def require(file) - result = false - load_dependency(file) { result = super } - result - end - end - def load? mechanism == :load end