lib/lopata/observers/console_output_observer.rb in lopata-0.1.28 vs lib/lopata/observers/console_output_observer.rb in lopata-0.1.29
- old
+ new
@@ -5,18 +5,22 @@
module Observers
# @private
class ConsoleOutputObserver < BaseObserver
extend Forwardable
# @private
- attr_reader :output
+ attr_reader :output, :statuses
# @private
def_delegators :output, :puts, :flush
def initialize
@output = $stdout
end
+ def started(world)
+ @statuses = {}
+ end
+
# @see Lopata::Observers::BaseObserver#finished
def finished(world)
total = statuses.values.inject(0, &:+)
counts = statuses.map do |status, count|
colored("%d %s", status) % [count, status]
@@ -101,13 +105,9 @@
# @param cols [Number] number of spaces to be added
# @param text [String] text to add indent
# @return [String] text with indent
def indent(cols, text)
text.split("\n").map { |line| " " * cols + line }.join("\n")
- end
-
- def statuses
- @statuses ||= {}
end
end
end
end