1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

let dependencies use Module#const_defined?

Module#const_defined? accepts constant paths in modern Ruby, we no longer
need our qualified_* extensions.

References #17845.
This commit is contained in:
Xavier Noria 2015-01-28 21:46:34 -08:00
parent 74c2961bd8
commit 80c30e4b8f

View file

@ -373,7 +373,7 @@ module ActiveSupport #:nodoc:
# Is the provided constant path defined?
def qualified_const_defined?(path)
Object.qualified_const_defined?(path.sub(/^::/, ''), false)
Object.const_defined?(path, false)
end
# Given +path+, a filesystem path to a ruby file, return an array of
@ -607,7 +607,7 @@ module ActiveSupport #:nodoc:
def autoloaded?(desc)
return false if desc.is_a?(Module) && desc.anonymous?
name = to_constant_name desc
return false unless qualified_const_defined? name
return false unless qualified_const_defined?(name)
return autoloaded_constants.include?(name)
end