aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2009-12-22 17:31:29 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-12-22 17:31:29 -0800
commite7ef57dd0ddec3d487d3ffd58ff028bdf11a33f9 (patch)
treedfc9e049c937a56c2fc1e80ae8e8b71880d1615d /activesupport
parentec095456d859da4a09c7401585c211dc0f01fccd (diff)
parentf737c2d69bb3659a553c7c0e21e316b1a4a1b98a (diff)
downloadrails-e7ef57dd0ddec3d487d3ffd58ff028bdf11a33f9.tar.gz
rails-e7ef57dd0ddec3d487d3ffd58ff028bdf11a33f9.tar.bz2
rails-e7ef57dd0ddec3d487d3ffd58ff028bdf11a33f9.zip
Merge
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support.rb53
-rw-r--r--activesupport/lib/active_support/dependencies/autoload.rb10
2 files changed, 33 insertions, 30 deletions
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb
index 9e21b3faf3..f2baa5a56a 100644
--- a/activesupport/lib/active_support.rb
+++ b/activesupport/lib/active_support.rb
@@ -39,31 +39,34 @@ require "active_support/dependencies/autoload"
module ActiveSupport
extend ActiveSupport::Autoload
- autoload :BacktraceCleaner
- autoload :Base64
- autoload :BasicObject
- autoload :Benchmarkable
- autoload :BufferedLogger
- autoload :Cache
- autoload :Callbacks
- autoload :Concern
- autoload :Configurable
- autoload :DeprecatedCallbacks
- autoload :Deprecation
- autoload :Gzip
- autoload :Inflector
- autoload :Memoizable
- autoload :MessageEncryptor
- autoload :MessageVerifier
- autoload :Multibyte
- autoload :OptionMerger
- autoload :OrderedHash
- autoload :OrderedOptions
- autoload :Notifications
- autoload :Rescuable
- autoload :SecureRandom
- autoload :StringInquirer
- autoload :XmlMini
+ # TODO: Narrow this list down
+ eager_autoload do
+ autoload :BacktraceCleaner
+ autoload :Base64
+ autoload :BasicObject
+ autoload :Benchmarkable
+ autoload :BufferedLogger
+ autoload :Cache
+ autoload :Callbacks
+ autoload :Concern
+ autoload :Configurable
+ autoload :DeprecatedCallbacks
+ autoload :Deprecation
+ autoload :Gzip
+ autoload :Inflector
+ autoload :Memoizable
+ autoload :MessageEncryptor
+ autoload :MessageVerifier
+ autoload :Multibyte
+ autoload :OptionMerger
+ autoload :OrderedHash
+ autoload :OrderedOptions
+ autoload :Notifications
+ autoload :Rescuable
+ autoload :SecureRandom
+ autoload :StringInquirer
+ autoload :XmlMini
+ end
end
require 'active_support/vendor'
diff --git a/activesupport/lib/active_support/dependencies/autoload.rb b/activesupport/lib/active_support/dependencies/autoload.rb
index 96ab04c61a..44edb89ad5 100644
--- a/activesupport/lib/active_support/dependencies/autoload.rb
+++ b/activesupport/lib/active_support/dependencies/autoload.rb
@@ -5,13 +5,13 @@ module ActiveSupport
@@autoloads = {}
@@under_path = nil
@@at_path = nil
- @@autoload_defer = false
+ @@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 @@autoload_defer
+ if @@eager_autoload
@@autoloads[const_name] = location
end
super const_name, location
@@ -31,11 +31,11 @@ module ActiveSupport
@@at_path = old_path
end
- def deferrable
- old_defer, @@autoload_defer = @@autoload_defer, true
+ def eager_autoload
+ old_eager, @@eager_autoload = @@eager_autoload, true
yield
ensure
- @@autoload_defer = old_defer
+ @@eager_autoload = old_eager
end
def self.eager_autoload!