Class: MutatorRails::MutationLog
- Inherits:
-
Object
- Object
- MutatorRails::MutationLog
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutator_rails/mutation_log.rb
Constant Summary collapse
- HEADER =
(['log', 'kills', 'alive', 'total', 'pct killed', 'mutations per sec', 'runtime', 'failure', 'j1'].join("\t") + "\n").freeze
Instance Method Summary collapse
- #alive ⇒ Object
- #complete? ⇒ Boolean
- #details ⇒ Object
-
#initialize ⇒ MutationLog
constructor
A new instance of MutationLog.
- #j1 ⇒ Object
- #link ⇒ Object
- #pct ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ MutationLog
Returns a new instance of MutationLog.
18 19 20 21 22 |
# File 'lib/mutator_rails/mutation_log.rb', line 18 def initialize(*) super @content = File.read(target_log) end |
Instance Method Details
#alive ⇒ Object
48 49 50 |
# File 'lib/mutator_rails/mutation_log.rb', line 48 def alive content.match(/Alive:.+?(\d+)$/)[1].to_i rescue 0 end |
#complete? ⇒ Boolean
32 33 34 |
# File 'lib/mutator_rails/mutation_log.rb', line 32 def complete? /^Subjects: / === content end |
#details ⇒ Object
36 37 38 39 40 |
# File 'lib/mutator_rails/mutation_log.rb', line 36 def details [klass, kills, alive, total, pct, mutations_per_sec, runtime, failure, j1] rescue [] end |
#j1 ⇒ Object
52 53 54 |
# File 'lib/mutator_rails/mutation_log.rb', line 52 def j1 content.match(/Jobs:.+?(\d+)$/)[1].to_i rescue 2 end |
#link ⇒ Object
56 57 58 |
# File 'lib/mutator_rails/mutation_log.rb', line 56 def link "=HYPERLINK(\"#{relative_path}\",\"#{klass}\")" end |
#pct ⇒ Object
42 43 44 45 46 |
# File 'lib/mutator_rails/mutation_log.rb', line 42 def pct return 100 unless total.positive? ((100.0 * kills.to_f) / total).round(3) end |
#to_s ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/mutator_rails/mutation_log.rb', line 24 def to_s return '' unless complete? [link, kills, alive, total, pct, mutations_per_sec, runtime, failure, j1].join("\t") rescue '' end |