class RspecOverview::Output::Csv

Attributes

headings[R]
rows[R]

Public Class Methods

new(headings:, rows:) click to toggle source
# File lib/rspec_overview/output/csv.rb, line 6
def initialize(headings:, rows:)
  @headings = headings
  @rows = rows
end

Public Instance Methods

to_s() click to toggle source
# File lib/rspec_overview/output/csv.rb, line 11
def to_s
  csv_content
end

Private Instance Methods

csv_content() click to toggle source
# File lib/rspec_overview/output/csv.rb, line 19
def csv_content
  CSV.generate(**csv_options, headers: headings) do |csv|
    rows.each { |row| csv << row }
  end
end
csv_options() click to toggle source
# File lib/rspec_overview/output/csv.rb, line 25
def csv_options
  { write_headers: true, force_quotes: true }
end