1 require 'active_support/deprecation'
3 # A deprecated mechanism to mark a class reloadable.
5 # Deprecated as of Rails 1.2.
6 # All autoloaded objects are now unloaded.
7 module Reloadable #:nodoc:
9 def included(base) #nodoc:
10 unless base.ancestors.include?(Reloadable::Subclasses) # Avoid double warning
11 ActiveSupport::Deprecation.warn "Reloadable has been deprecated and has no effect.", caller
14 raise TypeError, "Only Classes can be Reloadable!" unless base.is_a? Class
16 unless base.respond_to?(:reloadable?)
18 define_method(:reloadable?) do
19 ActiveSupport::Deprecation.warn "Reloadable has been deprecated and reloadable? has no effect", caller
26 def reloadable_classes
27 ActiveSupport::Deprecation.silence do
28 included_in_classes.select { |klass| klass.reloadable? }
31 deprecate :reloadable_classes
34 # Captures the common pattern where a base class should not be reloaded,
35 # but its subclasses should be.
37 # Deprecated as of Rails 1.2.
38 # All autoloaded objects are now unloaded.
39 module Subclasses #:nodoc:
40 def self.included(base) #nodoc:
41 base.send :include, Reloadable
42 ActiveSupport::Deprecation.warn "Reloadable::Subclasses has been deprecated and has no effect.", caller
43 (class << base; self; end).send(:define_method, :reloadable?) do
44 ActiveSupport::Deprecation.warn "Reloadable has been deprecated and reloadable? has no effect", caller
50 module Deprecated #:nodoc:
51 def self.included(base)
53 define_method(:reloadable?) do
54 ActiveSupport::Deprecation.warn "Reloadable has been deprecated and reloadable? has no effect", caller
55 true # This might not have the desired effect, as AR::B.reloadable? => true.