activesupport 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- data/CHANGELOG +6 -1
- data/lib/active_support/core_ext/object_and_class.rb +17 -13
- data/lib/active_support/dependencies.rb +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
class Object #:nodoc:
|
2
|
-
def remove_subclasses_of(
|
3
|
-
subclasses_of(
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
def remove_subclasses_of(*superclasses)
|
3
|
+
subclasses_of(*superclasses).each do |subclass|
|
4
|
+
subclass.instance_variables.each { |v| subclass.send(:remove_instance_variable, v) }
|
5
|
+
Object.send(:remove_const, subclass.to_s) rescue nil
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def remove_instance_variables_of(klass)
|
10
|
+
ObjectSpace.each_object(Class) do |k|
|
11
|
+
if k.to_s == klass
|
12
|
+
k.instance_variables.each { |v| k.send(:remove_instance_variable, v) }
|
13
|
+
end
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
|
-
def subclasses_of(
|
17
|
+
def subclasses_of(*superclasses)
|
14
18
|
subclasses = []
|
15
19
|
ObjectSpace.each_object(Class) do |k|
|
16
|
-
next if
|
17
|
-
subclasses << k
|
20
|
+
next if (k.ancestors & superclasses).empty? || superclasses.include?(k) || k.to_s.include?("::") || subclasses.include?(k)
|
21
|
+
subclasses << k
|
18
22
|
end
|
19
23
|
subclasses
|
20
24
|
end
|
@@ -46,6 +50,6 @@ class Class #:nodoc:
|
|
46
50
|
end
|
47
51
|
|
48
52
|
def subclasses
|
49
|
-
Object.subclasses_of(self)
|
53
|
+
Object.subclasses_of(self).map { |o| o.to_s }
|
50
54
|
end
|
51
55
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: activesupport
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.1.
|
7
|
-
date: 2005-07-
|
6
|
+
version: 1.1.1
|
7
|
+
date: 2005-07-11
|
8
8
|
summary: Support and utility classes used by the Rails framework.
|
9
9
|
require_paths:
|
10
10
|
- lib
|