Class: Evilution::CLI::Printers::Compare

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/cli/printers/compare.rb

Constant Summary collapse

SCHEMA =
{
  "shared" => %w[file line operator fp],
  "alive_only" => %w[file line operator fp other_status]
}.freeze
FILE_LINE_WIDTH =
40
OPERATOR_WIDTH =
22
FP_LENGTH =
7
MUTANT_OPERATOR =
"(mutant)"
ABSENT_STATUS =
"absent"

Instance Method Summary collapse

Constructor Details

#initialize(buckets, format: :json) ⇒ Compare

Returns a new instance of Compare.



18
19
20
21
# File 'lib/evilution/cli/printers/compare.rb', line 18

def initialize(buckets, format: :json)
  @buckets = buckets
  @format  = format || :json
end

Instance Method Details

#render(io) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/evilution/cli/printers/compare.rb', line 23

def render(io)
  case @format
  when :json then render_json(io)
  when :text then render_text(io)
  else raise Evilution::Error, "unknown compare format: #{@format.inspect}"
  end
end