Class: Test::Unit::Coverage::Collector

Inherits:
Object
  • Object
show all
Defined in:
lib/test/unit/coverage.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCollector

Returns a new instance of Collector.



60
61
62
# File 'lib/test/unit/coverage.rb', line 60

def initialize
  @printer = Coverage.printer || DefaultPrinter.new
end

Instance Attribute Details

#printerObject

Returns the value of attribute printer.



58
59
60
# File 'lib/test/unit/coverage.rb', line 58

def printer
  @printer
end

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/test/unit/coverage.rb', line 53

def available?
  Object.const_defined?(:Coverage)
end

Instance Method Details

#attach_to_mediator(mediator) ⇒ Object



64
65
66
67
68
69
# File 'lib/test/unit/coverage.rb', line 64

def attach_to_mediator(mediator)
  mediator.add_listener(UI::TestRunnerMediator::STARTED,
                        &method(:started))
  mediator.add_listener(UI::TestRunnerMediator::FINISHED,
                        &method(:finished))
end

#finished(result) ⇒ Object



75
76
77
# File 'lib/test/unit/coverage.rb', line 75

def finished(result)
  @printer.print(::Coverage.result)
end

#started(result) ⇒ Object



71
72
73
# File 'lib/test/unit/coverage.rb', line 71

def started(result)
  @result = result
end