lib/rubygems/commands/help_command.rb in rubygems-update-3.4.22 vs lib/rubygems/commands/help_command.rb in rubygems-update-3.5.0
- old
+ new
@@ -322,29 +322,29 @@
out << "GEM commands are:"
out << nil
margin_width = 4
- desc_width = @command_manager.command_names.map {|n| n.size }.max + 4
+ desc_width = @command_manager.command_names.map(&:size).max + 4
summary_width = 80 - margin_width - desc_width
wrap_indent = " " * (margin_width + desc_width)
format = "#{" " * margin_width}%-#{desc_width}s%s"
@command_manager.command_names.each do |cmd_name|
command = @command_manager[cmd_name]
- next if command.deprecated?
+ next if command&.deprecated?
summary =
if command
command.summary
else
"[No command found for #{cmd_name}]"
end
summary = wrap(summary, summary_width).split "\n"
- out << sprintf(format, cmd_name, summary.shift)
+ out << format(format, cmd_name, summary.shift)
until summary.empty? do
out << "#{wrap_indent}#{summary.shift}"
end
end