retroactive_module_inclusion 1.2.3 → 1.2.4
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.
- data.tar.gz.sig +0 -0
- data/History.rdoc +6 -0
- data/Rakefile +1 -1
- data/lib/retroactive_module_inclusion.rb +7 -13
- metadata +2 -2
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -31,27 +31,21 @@ module CoreExt
|
|
31
31
|
|
32
32
|
private
|
33
33
|
|
34
|
-
# @return [Array] All modules and classes which have self in its
|
34
|
+
# @return [Array] All modules and classes which have self in its
|
35
|
+
# ancestors tree, including self itself.
|
36
|
+
#
|
37
|
+
# JRuby (at least up to version 1.5.6) has ObjectSpace disabled by
|
38
|
+
# default, thus it might have to be temporarily enabled and then
|
39
|
+
# restored. Reference: {ObjectSpace: to have or not to have}[http://ola-bini.blogspot.com/2007/07/objectspace-to-have-or-not-to-have.html].
|
35
40
|
#
|
36
41
|
def pseudo_descendants
|
37
|
-
# JRuby (at least up to version 1.5.6) has ObjectSpace disabled by default,
|
38
|
-
# thus it must be enabled manually ([reference][2]).
|
39
|
-
#
|
40
|
-
# [1]: http://eigenclass.org/hiki/The+double+inclusion+problem "Dynamic Module Include Problem"
|
41
|
-
# [2]: http://ola-bini.blogspot.com/2007/07/objectspace-to-have-or-not-to-have.html "ObjectSpace: to have or not to have"
|
42
|
-
#
|
43
42
|
prev_jruby_objectspace_state = nil # only for scope reasons
|
44
43
|
if defined?(RUBY_DESCRIPTION) && RUBY_DESCRIPTION =~ /jruby/i
|
45
44
|
require 'jruby'
|
46
45
|
prev_jruby_objectspace_state = JRuby.objectspace
|
47
46
|
JRuby.objectspace = true
|
48
47
|
end
|
49
|
-
result =
|
50
|
-
ObjectSpace.each_object(::Module) do |m|
|
51
|
-
if m <= self # equiv. to "if m.include?(self) || m == self"
|
52
|
-
result << m
|
53
|
-
end
|
54
|
-
end
|
48
|
+
result = ObjectSpace.each_object(::Module).select {|m| m <= self } # equiv. to "m.include?(self) || m == self"
|
55
49
|
if defined?(RUBY_DESCRIPTION) && RUBY_DESCRIPTION =~ /jruby/i
|
56
50
|
JRuby.objectspace = prev_jruby_objectspace_state
|
57
51
|
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|