Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2.1.0) is shown here.
loadable_constants_for_path(path, bases = load_paths)
public
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.
# File activesupport/lib/active_support/dependencies.rb, line 144
def loadable_constants_for_path(path, bases = load_paths)
path = $1 if path =~ /\A(.*)\.rb\Z/
expanded_path = File.expand_path(path)
bases.collect do |root|
expanded_root = File.expand_path(root)
next unless %r{\A#{Regexp.escape(expanded_root)}(/|\\)} =~ expanded_path
nesting = expanded_path[(expanded_root.size)..-1]
nesting = nesting[1..-1] if nesting && nesting[0] == ?/
next if nesting.blank?
[
nesting.camelize,
# Special case: application.rb might define ApplicationControlller.
('ApplicationController' if nesting == 'application')
]
end.flatten.compact.uniq
end