Sha256: 022952489de0fe4f131bfe72cc4c60c278afb67217702f4fc55a06a55248ce5c

Contents?: true

Size: 434 Bytes

Versions: 2

Compression:

Stored size: 434 Bytes

Contents

module Tableview::Ouput
  class ASCII
    require 'terminal-table/import'
    def process(tv)
      @table = table { |t|
        tv.parts.each do |part|
          part.rows.each do |row|
            t.add_row row.cells.map {|cell| {:value => cell.contents}.merge(cell.options) }
          end
          t.add_separator unless part == tv.parts.last
        end
      }
    end
    
    def to_s
      @table.to_s
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tableview-0.2.0 lib/tableview/output/ascii.rb
tableview-0.1.0 lib/tableview/output/ascii.rb