Skip to content
Browse files

Clean up Gem::CommandManager#process_args

  • Loading branch information...
1 parent 24546d9 commit ec63b209e05067fbba1d01d5f6747d89b5b9a946 @drbrain drbrain committed
Showing with 14 additions and 12 deletions.
  1. +14 −12 lib/rubygems/command_manager.rb
View
26 lib/rubygems/command_manager.rb
@@ -147,24 +147,26 @@ def run(args, build_args=nil)
def process_args(args, build_args=nil)
args = args.to_str.split(/\s+/) if args.respond_to?(:to_str)
- if args.size == 0
+
+ if args.empty? then
say Gem::Command::HELP
- terminate_interaction(1)
+ terminate_interaction 1
end
- case args[0]
- when '-h', '--help'
+
+ case args.first
+ when '-h', '--help' then
say Gem::Command::HELP
- terminate_interaction(0)
- when '-v', '--version'
+ terminate_interaction 0
+ when '-v', '--version' then
say Gem::VERSION
- terminate_interaction(0)
- when /^-/
- alert_error "Invalid option: #{args[0]}. See 'gem --help'."
- terminate_interaction(1)
+ terminate_interaction 0
+ when /^-/ then
+ alert_error "Invalid option: #{args.first}. See 'gem --help'."
+ terminate_interaction 1
else
cmd_name = args.shift.downcase
- cmd = find_command(cmd_name)
- cmd.invoke_with_build_args(args, build_args)
+ cmd = find_command cmd_name
+ cmd.invoke_with_build_args args, build_args
end
end

0 comments on commit ec63b20

Please sign in to comment.
Something went wrong with that request. Please try again.