From 218445bb1fbda6b215b42e6149da672d330a7042 Mon Sep 17 00:00:00 2001 From: tomoya ishida Date: Thu, 3 Oct 2024 21:27:39 +0900 Subject: [ruby/rdoc] Fix ToRdoc#accept_table (https://github.com/ruby/rdoc/pull/1184) https://github.com/ruby/rdoc/commit/7b68545094 --- lib/rdoc/markup/to_rdoc.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/rdoc/markup/to_rdoc.rb b/lib/rdoc/markup/to_rdoc.rb index 88234f5096..90763ccfdb 100644 --- a/lib/rdoc/markup/to_rdoc.rb +++ b/lib/rdoc/markup/to_rdoc.rb @@ -249,8 +249,8 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter # Adds +table+ to the output def accept_table header, body, aligns - widths = header.zip(body) do |h, b| - [h.size, b.size].max + widths = header.zip(*body).map do |cols| + cols.map(&:size).max end aligns = aligns.map do |a| case a @@ -262,12 +262,12 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter :rjust end end - @res << header.zip(widths, aligns) do |h, w, a| + @res << header.zip(widths, aligns).map do |h, w, a| h.__send__(a, w) end.join("|").rstrip << "\n" @res << widths.map {|w| "-" * w }.join("|") << "\n" body.each do |row| - @res << row.zip(widths, aligns) do |t, w, a| + @res << row.zip(widths, aligns).map do |t, w, a| t.__send__(a, w) end.join("|").rstrip << "\n" end -- cgit v1.2.3