mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Simplify argument processing logic in gem list
& gem search
Make it more explicit that if not specific arguments are given, the
value of `-n` is used.
ed811ddc00
This commit is contained in:
parent
e4f8d5b2f5
commit
8b6a02de2f
1 changed files with 4 additions and 4 deletions
|
@ -58,10 +58,10 @@ module Gem::QueryUtils
|
|||
end
|
||||
|
||||
def execute
|
||||
gem_names = Array(options[:name])
|
||||
|
||||
if !args.empty?
|
||||
gem_names = options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i }
|
||||
gem_names = if args.empty?
|
||||
Array(options[:name])
|
||||
else
|
||||
options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i }
|
||||
end
|
||||
|
||||
terminate_interaction(check_installed_gems(gem_names)) if check_installed_gems?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue