Skip to content

Commit

Permalink
let dependencies use Module#const_defined?
Browse files Browse the repository at this point in the history
Module#const_defined? accepts constant paths in modern Ruby, we no longer
need our qualified_* extensions.

References #17845.
  • Loading branch information
fxn committed Jan 29, 2015
1 parent 74c2961 commit 80c30e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activesupport/lib/active_support/dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def require_or_load(file_name, const_path = nil)

# 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
Expand Down Expand Up @@ -607,7 +607,7 @@ def safe_constantize(name)
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

Expand Down

0 comments on commit 80c30e4

Please sign in to comment.