lib/arql/ext/array.rb in arql-0.1.18 vs lib/arql/ext/array.rb in arql-0.1.19

- old
+ new

@@ -21,12 +21,18 @@ each do |e| t << e.attributes.values_at(*attrs.map(&:to_s)) end } else - puts Terminal::Table.new { |t| + table = Terminal::Table.new { |t| v.each { |row| t << (row || :separator)} - } + }.to_s.lines.map(&:chomp) + + terminal_width = `tput cols`.to_i + if table.first.size > terminal_width + puts table[0..2].join("\n") + puts table[3..-1].join("\n#{'-' * terminal_width}\n") + end end end def v return self unless present?