lib/chronicle/etl/loaders/table_loader.rb in chronicle-etl-0.1.3 vs lib/chronicle/etl/loaders/table_loader.rb in chronicle-etl-0.1.4

- old
+ new

@@ -5,21 +5,17 @@ class TableLoader < Chronicle::Etl::Loader def initialize(options) super(options) end - # defer creating table until we get first result and can determine headers - def first_load(result) - headers = result.keys - @table = TTY::Table.new(header: headers) - end - def load(result) - @table << result + @table ||= TTY::Table.new(header: result.keys) + values = result.values.map{|x| x.to_s[0..30]} + @table << values end def finish - puts @table.render(:ascii) + puts @table.render(:ascii, padding: [0, 1]) end end end end