Sha256: 265623fa5e27d9e2492df4c51cdc5b581749f99f535cfc423155cf8638ae7172

Contents?: true

Size: 639 Bytes

Versions: 2

Compression:

Stored size: 639 Bytes

Contents

require 'csv'

module Omnitest
  module Reporters
    class HashReporter
      def initialize(io = $stdout)
        @buffer = io
      end

      def print_table(table)
        headers = table[0]
        data = []
        table[1..-1].map do |row|
          row_data = {}
          row.each_with_index do |value, index|
            row_data[headers[index]] = value
          end
          data << row_data
        end
        @buffer.puts convert(data)
      end

      def convert(_data)
        fail 'Subclass HashReporter and convert the data to the target format'
      end

      def colors?
        false
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omnitest-0.2.2 lib/omnitest/reporters/hash_reporter.rb
omnitest-0.2.1 lib/omnitest/reporters/hash_reporter.rb