class Chronicle::ETL::TableLoader

Public Class Methods

new(options) click to toggle source
Calls superclass method Chronicle::ETL::Loader::new
# File lib/chronicle/etl/loaders/table_loader.rb, line 6
def initialize(options)
  super(options)
end

Public Instance Methods

finish() click to toggle source
# File lib/chronicle/etl/loaders/table_loader.rb, line 17
def finish
  puts @table.render(:ascii, padding: [0, 1]) if @table
end
load(record) click to toggle source
# File lib/chronicle/etl/loaders/table_loader.rb, line 10
def load(record)
  record_hash = record.to_h_flattened
  @table ||= TTY::Table.new(header: record_hash.keys)
  values = record_hash.values.map{|x| x.to_s[0..30]}
  @table << values
end