Class: LabTech::Summary

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

Constant Summary collapse

TAB =
" " * 4
LINE =
"-" * 80
VAL =
""
DOT =
"·"

Instance Method Summary collapse

Constructor Details

#initialize(experiment) ⇒ Summary

Returns a new instance of Summary.



8
9
10
# File 'app/models/lab_tech/summary.rb', line 8

def initialize(experiment)
  @experiment = experiment
end

Instance Method Details

#to_sObject



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

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