Sha256: 8f40f510dd97d01ef83f16f4e936a6a0046f2c0b08743b40479d33127095fc2c

Contents?: true

Size: 427 Bytes

Versions: 1

Compression:

Stored size: 427 Bytes

Contents

require 'tty/table'

module Chronicle
  module Etl
    class TableLoader < Chronicle::Etl::Loader
      def initialize(options)
        super(options)
      end

      def load(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, padding: [0, 1])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chronicle-etl-0.1.4 lib/chronicle/etl/loaders/table_loader.rb