lib/rawbotz/cli/order_result_table.rb in rawbotz-0.1.5 vs lib/rawbotz/cli/order_result_table.rb in rawbotz-0.2.0

- old
+ new

@@ -1,9 +1,20 @@ module Rawbotz::CLI module OrderResultTable def self.tables diffs out = "" + if !diffs[:error].empty? + error_items = diffs[:error].map do |p| + [p[0][0..35]] + end + out << Terminal::Table.new(title: "With error", + headings: ['Product'], + rows: error_items, + style: {width: 60}).to_s + out << "\n\n" + end + if !diffs[:perfect].empty? perfect_items = diffs[:perfect].map do |p, q| [p.local_product.remote_product.name[0..35], q] end out << Terminal::Table.new(title: "Perfect", @@ -53,8 +64,10 @@ out << Terminal::Table.new(title: "Extra (not in rawbotz)", headings: ['Product', 'In Cart'], rows: extra_items, style: {width:60}).to_s end + + out end end end