diff options
Diffstat (limited to 'lib/rubygems/commands/dependency_command.rb')
-rw-r--r-- | lib/rubygems/commands/dependency_command.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb index 3f69a95e83..9aaefae999 100644 --- a/lib/rubygems/commands/dependency_command.rb +++ b/lib/rubygems/commands/dependency_command.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require_relative "../command" require_relative "../local_remote_options" require_relative "../version_option" @@ -10,15 +11,14 @@ class Gem::Commands::DependencyCommand < Gem::Command def initialize super "dependency", "Show the dependencies of an installed gem", - :version => Gem::Requirement.default, :domain => :local + version: Gem::Requirement.default, domain: :local add_version_option add_platform_option add_prerelease_option add_option("-R", "--[no-]reverse-dependencies", - "Include reverse dependencies in the output") do - |value, options| + "Include reverse dependencies in the output") do |value, options| options[:reverse_dependencies] = value end @@ -90,10 +90,9 @@ use with other commands. def display_pipe(specs) # :nodoc: specs.each do |spec| - unless spec.dependencies.empty? - spec.dependencies.sort_by {|dep| dep.name }.each do |dep| - say "#{dep.name} --version '#{dep.requirement}'" - end + next if spec.dependencies.empty? + spec.dependencies.sort_by(&:name).each do |dep| + say "#{dep.name} --version '#{dep.requirement}'" end end end @@ -153,7 +152,7 @@ use with other commands. response = String.new response << " " * level + "Gem #{spec.full_name}\n" unless spec.dependencies.empty? - spec.dependencies.sort_by {|dep| dep.name }.each do |dep| + spec.dependencies.sort_by(&:name).each do |dep| response << " " * level + " #{dep}\n" end end |