free_mutant/lib/mutant/reporter/trace.rb

39 lines
814 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 19:23:40 +00:00
end
%w[start progress report warn].each do |name|
define_method(name) do |object|
public_send(:"#{name}_calls") << object
self
end
end
2014-12-08 18:13:49 +00:00
REPORT_DELAY = 0.0
# Return report delay
#
# @return [Float]
#
# @api private
#
def delay
REPORT_DELAY
end
end # Tracker
end # reporter
end # Mutant