Skip to content

Commit 80c30e4

Browse files
committed
let dependencies use Module#const_defined?
Module#const_defined? accepts constant paths in modern Ruby, we no longer need our qualified_* extensions. References #17845.
1 parent 74c2961 commit 80c30e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activesupport/lib/active_support/dependencies.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def require_or_load(file_name, const_path = nil)
373373

374374
# Is the provided constant path defined?
375375
def qualified_const_defined?(path)
376-
Object.qualified_const_defined?(path.sub(/^::/, ''), false)
376+
Object.const_defined?(path, false)
377377
end
378378

379379
# Given +path+, a filesystem path to a ruby file, return an array of
@@ -607,7 +607,7 @@ def safe_constantize(name)
607607
def autoloaded?(desc)
608608
return false if desc.is_a?(Module) && desc.anonymous?
609609
name = to_constant_name desc
610-
return false unless qualified_const_defined? name
610+
return false unless qualified_const_defined?(name)
611611
return autoloaded_constants.include?(name)
612612
end
613613

0 commit comments

Comments
 (0)