aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/reloadable.rb12
2 files changed, 8 insertions, 6 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index b2dfa0744c..bd001f3196 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Add documentation for Reloadable::OnlySubclasses. [Nicholas Seckar]
+
* Add Reloadable::OnlySubclasses which handles the common case where a base class should not be reloaded, but its subclasses should be. [Nicholas Seckar]
* Further improvements to reloading code [Nicholas Seckar, Trevor Squires]
diff --git a/activesupport/lib/active_support/reloadable.rb b/activesupport/lib/active_support/reloadable.rb
index 7749f0b165..179e04a0fe 100644
--- a/activesupport/lib/active_support/reloadable.rb
+++ b/activesupport/lib/active_support/reloadable.rb
@@ -15,13 +15,13 @@ module Reloadable
end
end
+ # Captures the common pattern where a base class should not be reloaded,
+ # but its subclasses should be.
module OnlySubclasses
- class << self
- def included(base) #nodoc:
- base.send :include, Reloadable
- (class << base; self; end;).class_eval do
- define_method(:reloadable?) { self != base }
- end
+ def self.included(base) #nodoc:
+ base.send :include, Reloadable
+ (class << base; self; end).send(:define_method, :reloadable?) do
+ base != self
end
end
end