aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/module/reachable.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module/reachable.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/module/reachable.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/reachable.rb b/activesupport/lib/active_support/core_ext/module/reachable.rb
new file mode 100644
index 0000000000..443d2c3d53
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/module/reachable.rb
@@ -0,0 +1,10 @@
+require 'active_support/core_ext/module/anonymous'
+require 'active_support/core_ext/string/inflections'
+
+class Module
+ def reachable? #:nodoc:
+ !anonymous? && name.constantize.equal?(self)
+ rescue NameError
+ false
+ end
+end