Sha256: 26785bab204412ef41669b1e206864f73ffcde08d39a1758ec8d593a2aa8f200

Contents?: true

Size: 571 Bytes

Versions: 7

Compression:

Stored size: 571 Bytes

Contents

require 'csv'
require 'json'

module Tabula
  module Writers

    def Writers.CSV(lines, output=$stdout)
      lines.each do |l|
        output.write CSV.generate_line(l.map(&:text), row_sep: "\r\n")
      end
    end

    def Writers.JSON(lines, output=$stdout)
      output.write lines.to_json
    end

    def Writers.TSV(lines, output=$stdout)
      lines.each do |l|
        output.write CSV.generate_line(l.map(&:text), col_sep: "\t", row_sep: "\r\n")
      end
    end

    def Writers.HTML(lines, output=$stdout)
      raise "not implemented"
    end


  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tabula-extractor-0.8.0-java lib/tabula/writers.rb
tabula-extractor-0.7.6-java lib/tabula/writers.rb
tabula-extractor-0.7.5-java lib/tabula/writers.rb
tabula-extractor-0.7.4-java lib/tabula/writers.rb
tabula-extractor-0.7.2-java lib/tabula/writers.rb
tabula-extractor-0.7.1-java lib/tabula/writers.rb
tabula-extractor-0.7.0-java lib/tabula/writers.rb