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