Skip to content

Commit c2a38b6

Browse files
committed
Convert Set to Array before using as header
This is needed in cases where a table rendered using an Array of Hashes has more than `maxcols` columns. The error is `NoMethodError` with `Set#[]` on line 83, where header is indexed into.
1 parent 4fa06a9 commit c2a38b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/iruby/formatter.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def table(obj, maxrows: 15, maxcols: 15, **options)
6161
rows << row
6262
end
6363

64-
if header = keys
64+
if keys
65+
header = keys.to_a
6566
keys.merge(0...array_size)
6667
else
6768
keys = 0...array_size

0 commit comments

Comments
 (0)