summaryrefslogtreecommitdiff
path: root/lib/rubygems/command_manager.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-30 08:49:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-30 08:49:48 +0000
commit270ece8441b26dbfbd0ca3fdcb70efec263791a8 (patch)
treeec8bb34811fa2b478296dff279d116967a0d605b /lib/rubygems/command_manager.rb
parent9004431714f2aec1fe3cbcf096f9424e87ca5429 (diff)
* lib/rubygems/command_manager.rb (Gem#load_and_instantiate):
rescue only NameError from const_get. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/command_manager.rb')
-rw-r--r--lib/rubygems/command_manager.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index 0a19016..cd1fd6b 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -154,11 +154,12 @@ class Gem::CommandManager
def load_and_instantiate(command_name)
command_name = command_name.to_s
+ const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase } << "Command"
+ commands = Gem::Commands
retried = false
begin
- const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase }
- Gem::Commands.const_get("#{const_name}Command").new
+ commands.const_get(const_name)
rescue NameError
if retried then
raise
@@ -167,7 +168,7 @@ class Gem::CommandManager
require "rubygems/commands/#{command_name}_command"
retry
end
- end
+ end.new
end
end