free_mutant/lib/mutant/reporter/trace.rb

27 lines
643 B
Ruby
Raw Normal View History

module Mutant
class Reporter
# Reporter to trace report calls, used as a spec adapter
class Trace
include Adamantium::Mutable, Anima.new(:start_calls, :progress_calls, :report_calls, :warn_calls)
# Return new trace reporter
#
# @return [Trace]
#
# @api private
#
def self.new
super(Hash[anima.attribute_names.map { |name| [name, []] }])
2014-07-02 15:23:40 -04:00
end
%w[start progress report warn].each do |name|
define_method(name) do |object|
public_send(:"#{name}_calls") << object
self
end
end
end # Tracker
end # reporter
end # Mutant