Sha256: aa4283af4df1f922ac379b525c81b4581da04d86d5174d7f0e19091be58786f5

Contents?: true

Size: 891 Bytes

Versions: 2

Compression:

Stored size: 891 Bytes

Contents

module Mutant
  class Reporter
    WIDTH = 70

    def self.mutating(mutation)
      puts "Mutating line #{mutation.line}"
      puts "  #{mutation.from} >>>#{mutation.to.nested? ? "\n  " : " "}#{mutation.to}"
      puts
    end

    def self.method_loaded(mutatee)
      info "#{mutatee} loaded with #{mutatee.mutations.size} " \
           "possible #{pluralize(mutatee.mutations.size, 'mutation')}"
    end

    def self.no_mutations(mutatee)
      warning "#{mutatee} has no possible mutations"
    end

    def self.info(message)
      puts "*" * WIDTH
      puts "***  #{message}"
      puts "*" * WIDTH
      puts
    end

    def self.warning(message)
      puts "!" * WIDTH
      puts "!!!  #{message}"
      puts "!" * WIDTH
      puts
    end

    def self.pluralize(count, singular, plural = nil)
      count == 1 ? singular : plural || singular.insert(-1, 's')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.1.1 lib/mutant/reporter.rb
mutant-0.1.0 lib/mutant/reporter.rb