aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-11-23 14:56:39 -0700
committerSean Griffin <sean@seantheprogrammer.com>2015-11-23 14:56:39 -0700
commit68207cd4839d6c76d805e88aef19db5a61aa9f94 (patch)
treef5436d8d2aaa0452683133aa43913c700b49cbbd
parente8d73dd18a459dc4beed31787303efe64365451d (diff)
parenta7b207d10943d2e587ffeb785f57203955c946fa (diff)
downloadrails-68207cd4839d6c76d805e88aef19db5a61aa9f94.tar.gz
rails-68207cd4839d6c76d805e88aef19db5a61aa9f94.tar.bz2
rails-68207cd4839d6c76d805e88aef19db5a61aa9f94.zip
Merge pull request #22385 from headius/each_object_singleton_test
Test if each_object(singleton_class) works, since JRuby added it.
-rw-r--r--activesupport/lib/active_support/core_ext/class/subclasses.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/subclasses.rb b/activesupport/lib/active_support/core_ext/class/subclasses.rb
index 3c4bfc5f1e..b0f9a8be34 100644
--- a/activesupport/lib/active_support/core_ext/class/subclasses.rb
+++ b/activesupport/lib/active_support/core_ext/class/subclasses.rb
@@ -3,7 +3,8 @@ require 'active_support/core_ext/module/reachable'
class Class
begin
- ObjectSpace.each_object(Class.new) {}
+ # Test if this Ruby supports each_object against singleton_class
+ ObjectSpace.each_object(Numeric.singleton_class) {}
def descendants # :nodoc:
descendants = []
@@ -12,7 +13,7 @@ class Class
end
descendants
end
- rescue StandardError # JRuby
+ rescue StandardError # JRuby 9.0.4.0 and earlier
def descendants # :nodoc:
descendants = []
ObjectSpace.each_object(Class) do |k|