Sha256: 7e3fa5334a8d7f02881ab78811818e1a4d719355e8521d8e708fb4f5de8ff4cf

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

require 'terminal-table'
require 'pageme'
module DocParser
  # This Output is can be used for debugging purposes.

  # It pipes all rows through a pager
  # @see Output
  class ScreenOutput < Output
    # @!visibility private

    include PageMe

    def initialize
      @tables = []
      @rowcount = 0
    end

    def close
      page do |p|
        p.puts "Showing all #{@tables.length} rows:\n\n"
        @tables.each do |table|
          p.puts table
        end
      end
    end

    def write_row(row)
      out = []
      0.upto(@header.length - 1) do |counter|
        out << [@header[counter], row[counter]]
      end
      @tables << Terminal::Table.new(rows: out)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docparser-0.0.1 lib/docparser/output/screen_output.rb