Class: Mutant::Reporter::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/mutant/reporter/stats.rb

Overview

Stats gathered while reporter is running

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStats

Returns a new instance of Stats.



39
40
41
42
# File 'lib/mutant/reporter/stats.rb', line 39

def initialize
  @start = Time.now
  @subject = @mutation = @kill = @time = 0
end

Instance Attribute Details

#killFixnum (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return kill count

Returns:

  • (Fixnum)


29
30
31
# File 'lib/mutant/reporter/stats.rb', line 29

def kill
  @kill
end

#mutationFixnum (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return mutation count

Returns:

  • (Fixnum)


21
22
23
# File 'lib/mutant/reporter/stats.rb', line 21

def mutation
  @mutation
end

#subjectFixnum (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return subject count

Returns:

  • (Fixnum)


13
14
15
# File 'lib/mutant/reporter/stats.rb', line 13

def subject
  @subject
end

#timeFloat (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return mutation runtime

Returns:

  • (Float)


37
38
39
# File 'lib/mutant/reporter/stats.rb', line 37

def time
  @time
end

Instance Method Details

#aliveObject



52
53
54
# File 'lib/mutant/reporter/stats.rb', line 52

def alive
  @mutation - @kill
end

#killer(killer) ⇒ Object



56
57
58
59
60
# File 'lib/mutant/reporter/stats.rb', line 56

def killer(killer)
  @mutation +=1
  @kill +=1 unless killer.fail?
  @time += killer.runtime
end

#runtimeObject



44
45
46
# File 'lib/mutant/reporter/stats.rb', line 44

def runtime
  Time.now - @start
end