diff options
| author | Andy Waite <13400+andyw8@users.noreply.github.com> | 2023-07-04 16:45:02 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-07-04 20:45:07 +0000 |
| commit | fd6da40fef5c6b818564ed0bc47672d1e069039c (patch) | |
| tree | 9c2e3b74d5cf598722ea9c781f5c4fc72a4603c9 /lib | |
| parent | 6b2abe570f0ecb1ec0e401be0eb4172f35b78307 (diff) | |
[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>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/irb/cmd/show_cmds.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/irb/cmd/show_cmds.rb b/lib/irb/cmd/show_cmds.rb index acced27d48..490561825e 100644 --- a/lib/irb/cmd/show_cmds.rb +++ b/lib/irb/cmd/show_cmds.rb @@ -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 |
