Class: LabTech::Summary

Inherits:
Object
  • Object
show all
Defined in:
app/models/lab_tech/summary.rb,
app/models/lab_tech/summary/count.rb,
app/models/lab_tech/summary/speedup_line.rb

Defined Under Namespace

Classes: Count, SpeedupLine

Constant Summary collapse

TAB =
" " * 4
LINE =
"-" * 80

Instance Method Summary collapse

Constructor Details

#initialize(experiment) ⇒ Summary

Returns a new instance of Summary.



6
7
8
# File 'app/models/lab_tech/summary.rb', line 6

def initialize(experiment)
  @experiment = experiment
end

Instance Method Details

#to_sObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/lab_tech/summary.rb', line 10

def to_s
  if experiment.results.count.zero?
    return [ LINE, "No results for experiment #{@experiment.name.inspect}", LINE ].join("\n")
  end

  fetch_data

  s = StringIO.new
  s.puts LINE, "Experiment: #{@experiment.name}", LINE

  add_time_span_to s
  add_counts_to s

  if @time_deltas.any?
    add_time_deltas_to s
    add_speedup_chart_to s
  end

  s.puts LINE
  return s.string
end