Sha256: c8d7361e9317f2fe56a7daf3385d60e66b8febb717c98a92dd41f7a9588c7def

Contents?: true

Size: 579 Bytes

Versions: 2

Compression:

Stored size: 579 Bytes

Contents

module Polytrix
  module CLI
    module Reports
      class MarkdownReporter
        def initialize(io = $stdout)
          @buffer = io
        end

        def print_table(table)
          @buffer.puts # Markdown tables don't always render properly without a break
          header_data = table[0]
          header_line = header_data.join ' | '
          @buffer.puts header_line
          @buffer.puts header_line.gsub(/[^|]/, '-')

          table[1..-1].each do |data_line|
            @buffer.puts data_line.join ' | '
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polytrix-0.1.0 lib/polytrix/cli/reports/markdown_reporter.rb
polytrix-0.1.0.pre lib/polytrix/cli/reports/markdown_reporter.rb