Delete AS::Dependencies.loadable_constants_for_path

This commit is contained in:
Xavier Noria 2021-08-18 22:46:13 +02:00
parent 98381b7ba2
commit 805067e6d2
2 changed files with 0 additions and 27 deletions

View File

@ -198,29 +198,6 @@ module ActiveSupport # :nodoc:
Object.const_defined?(path, false)
end
# Given +path+, a filesystem path to a ruby file, return an array of
# constant paths which would cause Dependencies to attempt to load this
# file.
def loadable_constants_for_path(path, bases = autoload_paths)
path = path.chomp(".rb")
expanded_path = File.expand_path(path)
paths = []
bases.each do |root|
expanded_root = File.expand_path(root)
next unless expanded_path.start_with?(expanded_root)
root_size = expanded_root.size
next if expanded_path[root_size] != ?/
nesting = expanded_path[(root_size + 1)..-1]
paths << nesting.camelize unless nesting.blank?
end
paths.uniq!
paths
end
# Search for a file in autoload_paths matching the provided suffix.
def search_for_file(path_suffix)
path_suffix += ".rb" unless path_suffix.end_with?(".rb")

View File

@ -35,10 +35,6 @@ class DependenciesTest < ActiveSupport::TestCase
assert_includes "uninitialized constant ImaginaryObject", e.message
end
def test_loadable_constants_for_path_should_handle_empty_autoloads
assert_equal [], ActiveSupport::Dependencies.loadable_constants_for_path("hello")
end
def test_qualified_const_defined
assert ActiveSupport::Dependencies.qualified_const_defined?("Object")
assert ActiveSupport::Dependencies.qualified_const_defined?("::Object")