diff options
Diffstat (limited to 'lib/rubygems/query_utils.rb')
-rw-r--r-- | lib/rubygems/query_utils.rb | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb index c72955f83b..a95a759401 100644 --- a/lib/rubygems/query_utils.rb +++ b/lib/rubygems/query_utils.rb @@ -6,7 +6,6 @@ require_relative "version_option" require_relative "text" module Gem::QueryUtils - include Gem::Text include Gem::LocalRemoteOptions include Gem::VersionOption @@ -17,7 +16,7 @@ module Gem::QueryUtils options[:installed] = value end - add_option("-I", "Equivalent to --no-installed") do |value, options| + add_option("-I", "Equivalent to --no-installed") do |_value, options| options[:installed] = false end @@ -85,7 +84,7 @@ module Gem::QueryUtils installed = !installed unless options[:installed] say(installed) - exit_code = 1 if !installed + exit_code = 1 unless installed end exit_code @@ -119,7 +118,7 @@ module Gem::QueryUtils end end - #Guts of original execute + # Guts of original execute def show_gems(name) show_local_gems(name) if local? show_remote_gems(name) if remote? @@ -197,7 +196,7 @@ module Gem::QueryUtils end def output_versions(output, versions) - versions.each do |gem_name, matching_tuples| + versions.each do |_gem_name, matching_tuples| matching_tuples = matching_tuples.sort_by {|n,_| n.version }.reverse platforms = Hash.new {|h,version| h[version] = [] } @@ -243,7 +242,7 @@ module Gem::QueryUtils list = if platforms.empty? || options[:details] - name_tuples.map {|n| n.version }.uniq + name_tuples.map(&:version).uniq else platforms.sort.reverse.map do |version, pls| out = version.to_s @@ -264,7 +263,7 @@ module Gem::QueryUtils end end - entry << " (#{list.join ', '})" + entry << " (#{list.join ", "})" end def make_entry(entry_tuples, platforms) @@ -283,7 +282,7 @@ module Gem::QueryUtils end def spec_authors(entry, spec) - authors = "Author#{spec.authors.length > 1 ? 's' : ''}: ".dup + authors = "Author#{spec.authors.length > 1 ? "s" : ""}: ".dup authors << spec.authors.join(", ") entry << format_text(authors, 68, 4) end @@ -297,7 +296,7 @@ module Gem::QueryUtils def spec_license(entry, spec) return if spec.license.nil? || spec.license.empty? - licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup + licenses = "License#{spec.licenses.length > 1 ? "s" : ""}: ".dup licenses << spec.licenses.join(", ") entry << "\n" << format_text(licenses, 68, 4) end @@ -312,8 +311,8 @@ module Gem::QueryUtils label = "Installed at" specs.each do |s| version = s.version.to_s - version << ", default" if s.default_gem? - entry << "\n" << " #{label} (#{version}): #{s.base_dir}" + default = ", default" if s.default_gem? + entry << "\n" << " #{label} (#{version}#{default}): #{s.base_dir}" label = " " * label.length end end @@ -328,11 +327,11 @@ module Gem::QueryUtils if platforms.length == 1 title = platforms.values.length == 1 ? "Platform" : "Platforms" - entry << " #{title}: #{platforms.values.sort.join(', ')}\n" + entry << " #{title}: #{platforms.values.sort.join(", ")}\n" else entry << " Platforms:\n" - sorted_platforms = platforms.sort_by {|version,| version } + sorted_platforms = platforms.sort sorted_platforms.each do |version, pls| label = " #{version}: " @@ -347,5 +346,4 @@ module Gem::QueryUtils summary = truncate_text(spec.summary, "the summary for #{spec.full_name}") entry << "\n\n" << format_text(summary, 68, 4) end - end |