class Crispr::Reporter

Reporter collects mutation testing results and prints a summary.

def initialize

Initializes a new Reporter.
def initialize
  @killed = 0
  @survived = 0
end

def record(killed:)

Returns:
  • (void) -

Parameters:
  • killed (Boolean) -- whether the mutation was killed
def record(killed:)
  killed ? @killed += 1 : @survived += 1
end

def score

Returns:
  • (Float) - the mutation score
def score
  total = @killed + @survived
  total.zero? ? 0.0 : (@killed.to_f / total * 100).round(2)
end

def summary

Returns:
  • (Hash) - summary statistics including totals and score
def summary
  total = @killed + @survived
  {
    mutations: total,
    killed: @killed,
    survived: @survived,
    score: score
  }
end