class MatrixFormatter::Formatters::MarkdownFormatter

Public Instance Methods

markdown() click to toggle source
# File lib/matrix_formatter/formatters/markdown_formatter.rb, line 4
def markdown
  buffer = StringIO.new
  header_line = ['Feature Group', 'Feature', RSpec.configuration.matrix_implementors].join ' | '
  buffer.puts header_line
  buffer.puts header_line.gsub(/[^|]/, '-')

  @matrix.results.each do |product, features|
    # Only show the product on the first line
    product_text = "**#{product}**"
    features.each do |feature_key, feature_results|
      states = RSpec.configuration.matrix_implementors.map { |implementor|
        feature_results[implementor]
      }
      buffer.puts [product_text, "**#{feature_key}**", states].join ' | '
      product_text = ''
    end
  end
  buffer.string
end
start_dump() click to toggle source
# File lib/matrix_formatter/formatters/markdown_formatter.rb, line 24
def start_dump
  @output.puts markdown
end