Module: Zendesk::Printer::Table
- Defined in:
- lib/zendesk/printer/table.rb
Class Method Summary collapse
Class Method Details
.print(results) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/zendesk/printer/table.rb', line 10 def print(results) results.keys.each do |table_name| title = table_name.capitalize table = Terminal::Table.new title: title do |table| results[table_name].map do |row| rows = row.keys.zip row.values.map { |value| value.is_a?(String) ? value.truncate(100) : value } rows.each do |row| table.add_row row end table.add_separator unless row == results[table_name].last end end puts table end end |