|
Revision 5981, 2.0 kB
(checked in by david, 2 years ago)
|
Keep the irrelevant stuff out with :nodoc:
|
| Line | |
|---|
| 1 |
require 'active_support/deprecation' |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
module Reloadable |
|---|
| 8 |
class << self |
|---|
| 9 |
def included(base) |
|---|
| 10 |
unless base.ancestors.include?(Reloadable::Subclasses) |
|---|
| 11 |
ActiveSupport::Deprecation.warn "Reloadable has been deprecated and has no effect.", caller |
|---|
| 12 |
end |
|---|
| 13 |
|
|---|
| 14 |
raise TypeError, "Only Classes can be Reloadable!" unless base.is_a? Class |
|---|
| 15 |
|
|---|
| 16 |
unless base.respond_to?(:reloadable?) |
|---|
| 17 |
class << base |
|---|
| 18 |
define_method(:reloadable?) do |
|---|
| 19 |
ActiveSupport::Deprecation.warn "Reloadable has been deprecated and reloadable? has no effect", caller |
|---|
| 20 |
true |
|---|
| 21 |
end |
|---|
| 22 |
end |
|---|
| 23 |
end |
|---|
| 24 |
end |
|---|
| 25 |
|
|---|
| 26 |
def reloadable_classes |
|---|
| 27 |
ActiveSupport::Deprecation.silence do |
|---|
| 28 |
included_in_classes.select { |klass| klass.reloadable? } |
|---|
| 29 |
end |
|---|
| 30 |
end |
|---|
| 31 |
deprecate :reloadable_classes |
|---|
| 32 |
end |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
module Subclasses |
|---|
| 40 |
def self.included(base) |
|---|
| 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 |
|---|
| 45 |
base != self |
|---|
| 46 |
end |
|---|
| 47 |
end |
|---|
| 48 |
end |
|---|
| 49 |
|
|---|
| 50 |
module Deprecated |
|---|
| 51 |
def self.included(base) |
|---|
| 52 |
class << base |
|---|
| 53 |
define_method(:reloadable?) do |
|---|
| 54 |
ActiveSupport::Deprecation.warn "Reloadable has been deprecated and reloadable? has no effect", caller |
|---|
| 55 |
true |
|---|
| 56 |
end |
|---|
| 57 |
end |
|---|
| 58 |
end |
|---|
| 59 |
end |
|---|
| 60 |
end |
|---|