Class: LabTech::Summary::SpeedupLine
- Inherits:
-
Object
- Object
- LabTech::Summary::SpeedupLine
- Defined in:
- app/models/lab_tech/summary/speedup_line.rb
Constant Summary collapse
- VAL =
"█"
- DOT =
"·"
Instance Attribute Summary collapse
-
#n ⇒ Object
readonly
Returns the value of attribute n.
-
#speedup_factors ⇒ Object
readonly
Returns the value of attribute speedup_factors.
Instance Method Summary collapse
-
#initialize(n, speedup_factors) ⇒ SpeedupLine
constructor
A new instance of SpeedupLine.
- #to_s ⇒ Object
Constructor Details
#initialize(n, speedup_factors) ⇒ SpeedupLine
Returns a new instance of SpeedupLine.
10 11 12 13 |
# File 'app/models/lab_tech/summary/speedup_line.rb', line 10 def initialize(n, speedup_factors) @n = n @speedup_factors = speedup_factors end |
Instance Attribute Details
#n ⇒ Object (readonly)
Returns the value of attribute n.
8 9 10 |
# File 'app/models/lab_tech/summary/speedup_line.rb', line 8 def n @n end |
#speedup_factors ⇒ Object (readonly)
Returns the value of attribute speedup_factors.
8 9 10 |
# File 'app/models/lab_tech/summary/speedup_line.rb', line 8 def speedup_factors @speedup_factors end |
Instance Method Details
#to_s ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/lab_tech/summary/speedup_line.rb', line 15 def to_s highlight = ( n == 50 ) # Only 'highlight' (add dots to) the median line label = "%3d%%" % n speedup_factor = LabTech::Percentile.call(n, @speedup_factors) rel_speedup = "%+.1fx" % speedup_factor = ( speedup_factor, speedup_magnitude, highlight: highlight) speedup_cue = pad_left( rel_speedup, speedup_width ) speedup_cue += " faster" if speedup_factor > 0 "#{label} #{bar} #{speedup_cue}" end |