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.
Source Code
# File active_support/dependencies.rb, line 132 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
<code/>and<pre/>for code samples.