2014-05-12 13:48:15 +00:00
|
|
|
module Mutant
|
|
|
|
class Reporter
|
|
|
|
# Reporter to trace report calls, used as a spec adapter
|
|
|
|
class Trace
|
2014-08-10 22:09:29 +00:00
|
|
|
include Adamantium::Mutable, Anima.new(:start_calls, :progress_calls, :report_calls, :warn_calls)
|
2014-05-12 13:48:15 +00:00
|
|
|
|
|
|
|
# Return new trace reporter
|
|
|
|
#
|
2014-07-03 21:16:12 +00:00
|
|
|
# @return [Trace]
|
2014-05-12 13:48:15 +00:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def self.new
|
2014-07-03 21:16:12 +00:00
|
|
|
super(Hash[anima.attribute_names.map { |name| [name, []] }])
|
2014-07-02 19:23:40 +00:00
|
|
|
end
|
|
|
|
|
2014-08-11 13:50:48 +00:00
|
|
|
%w[start progress report warn].each do |name|
|
|
|
|
define_method(name) do |object|
|
|
|
|
public_send(:"#{name}_calls") << object
|
|
|
|
self
|
|
|
|
end
|
2014-05-12 13:48:15 +00:00
|
|
|
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
|
|
|
|
|
2014-05-12 13:48:15 +00:00
|
|
|
end # Tracker
|
|
|
|
end # reporter
|
|
|
|
end # Mutant
|