diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2010-09-05 11:23:39 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-05 18:14:47 +0200 |
commit | 9a776c29782f1c3e9d81e9fe5ff488b78bd32d41 (patch) | |
tree | a9016499ff70fc6fb73367ff992cf2825b56ab35 /activesupport/lib | |
parent | 69a4c67a3fdbc5e57e2e27519eec5f5669062e64 (diff) | |
download | rails-9a776c29782f1c3e9d81e9fe5ff488b78bd32d41.tar.gz rails-9a776c29782f1c3e9d81e9fe5ff488b78bd32d41.tar.bz2 rails-9a776c29782f1c3e9d81e9fe5ff488b78bd32d41.zip |
Improve dependencies by not calling constantize(const) twice while removing unloadable constants
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 4bd97d3ee3..95bb588f3f 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -64,8 +64,8 @@ module ActiveSupport #:nodoc: self.log_activity = false # The WatchStack keeps a stack of the modules being watched as files are loaded. - # If a file in the process of being loaded (parent.rb) triggers the load of - # another file (child.rb) the stack will ensure that child.rb handles the new + # If a file in the process of being loaded (parent.rb) triggers the load of + # another file (child.rb) the stack will ensure that child.rb handles the new # constants. # # If child.rb is being autoloaded, its constants will be added to @@ -641,7 +641,8 @@ module ActiveSupport #:nodoc: parent = Inflector.constantize(names * '::') log "removing constant #{const}" - constantize(const).before_remove_const if constantize(const).respond_to?(:before_remove_const) + constantized = constantize(const) + constantized.before_remove_const if constantized.respond_to?(:before_remove_const) parent.instance_eval { remove_const to_remove } return true |