class MutatorRails::MutationLog
Constants
- HEADER
Attributes
content[R]
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/mutator_rails/mutation_log.rb, line 18 def initialize(*) super @content = File.read(target_log) end
Public Instance Methods
alive()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 48 def alive content.match(/Alive:.+?(\d+)$/)[1].to_i rescue 0 end
complete?()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 32 def complete? /^Subjects: / === content end
details()
click to toggle source
# 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()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 52 def j1 content.match(/Jobs:.+?(\d+)$/)[1].to_i rescue 2 end
link()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 56 def link "=HYPERLINK(\"#{relative_path}\",\"#{klass}\")" end
pct()
click to toggle source
# 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()
click to toggle source
# 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
Private Instance Methods
<=>(other)
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 110 def <=>(other) [pct, -alive, link] <=> [other.pct, -other.alive, other.link] end
absolute_file_path()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 85 def absolute_file_path Pathname(target_log).realpath end
csv()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 72 def csv MutatorRails::Config.configuration.analysis_csv end
csv_file()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 68 def csv_file Pathname(File.dirname(Pathname(csv))).realpath end
failure()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 81 def failure /Failures:/ === content end
kills()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 89 def kills content.match(/Kills:.+?(\d+)$/)[1] rescue 0 end
klass()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 76 def klass k = content.match(/match_expressions: \[(.+?)\]>$/) k ? k[1] : '' end
mutations_per_sec()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 93 def mutations_per_sec return 0 unless runtime.positive? (total.to_f / runtime).round(3) end
relative_path()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 64 def relative_path absolute_file_path.relative_path_from(csv_file) end
runtime()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 100 def runtime content.match(/Runtime:\s+?(.+)s/).captures.first.to_f rescue 0.0 end
total()
click to toggle source
# File lib/mutator_rails/mutation_log.rb, line 106 def total alive.to_i + kills.to_i end