Sha256: 9e9bd3bcc82e7b3b759ac80327fcaef4ed6068a187a384daeddbe15d109ff50a
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
# frozen_string_literal: true module Mutant class Reporter class CLI # CLI runner status printer base class class Printer include AbstractType, Adamantium::Flat, Concord.new(:output, :object), Procto.call(:run) private_class_method :new # Create delegators to object # # @return [undefined] def self.delegate(*names) names.each(&method(:define_delegator)) end private_class_method :delegate # Create delegator to object # # @param [Symbol] name # # @return [undefined] def self.define_delegator(name) define_method(name) do object.public_send(name) end private(name) end private_class_method :define_delegator delegate :success? NL = "\n" # Run printer # # @return [self] abstract_method :run private def status_color success? ? Color::GREEN : Color::RED end def visit_collection(printer, collection) collection.each do |object| visit(printer, object) end end def visit(printer, object) printer.call(output, object) end def info(string, *arguments) puts(string % arguments) end def status(string, *arguments) puts(colorize(status_color, string % arguments)) end def puts(string) output.puts(string) end def colorize(color, message) color = Color::NONE unless tty? color.format(message) end def tty? output.tty? end alias_method :color?, :tty? end # Printer end # CLI end # Reporter end # Mutant
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mutant-0.9.9 | lib/mutant/reporter/cli/printer.rb |