[ruby/irb] Use max_by
for longest_cmd_name_length
(https://github.com/ruby/irb/pull/628) https://github.com/ruby/irb/commit/5e87f3bfdd Co-authored-by: Andy Waite <andyw8@users.noreply.github.com>
This commit is contained in:
parent
6b2abe570f
commit
fd6da40fef
@ -14,7 +14,7 @@ module IRB
|
||||
def execute(*args)
|
||||
commands_info = IRB::ExtendCommandBundle.all_commands_info
|
||||
commands_grouped_by_categories = commands_info.group_by { |cmd| cmd[:category] }
|
||||
longest_cmd_name_length = commands_info.map { |c| c[:display_name] }.max { |a, b| a.length <=> b.length }.length
|
||||
longest_cmd_name_length = commands_info.map { |c| c[:display_name].length }.max
|
||||
|
||||
output = StringIO.new
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user