Skip to content

Commit

Permalink
Merge pull request rails#5387 from panthomakos/autoload
Browse files Browse the repository at this point in the history
Improved ActiveSupport::Autoload Performance
  • Loading branch information
josevalim committed Mar 12, 2012
2 parents 6c0d5a1 + 6b480d2 commit 0533ee4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions activesupport/lib/active_support/dependencies/autoload.rb
Expand Up @@ -9,13 +9,16 @@ module Autoload
@@eager_autoload = false

def autoload(const_name, path = @@at_path)
full = [self.name, @@under_path, const_name.to_s, path].compact.join("::")
location = path || Inflector.underscore(full)
unless path
full = [name, @@under_path, const_name.to_s, path].compact.join("::")
path = Inflector.underscore(full)
end

if @@eager_autoload
@@autoloads[const_name] = location
@@autoloads[const_name] = path
end
super const_name, location

super const_name, path
end

def autoload_under(path)
Expand Down

0 comments on commit 0533ee4

Please sign in to comment.