Class: WhatTheGem::Stats::Metric
- Defined in:
- lib/whatthegem/stats/meters.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(name, value, *thresholds) ⇒ Metric
constructor
A new instance of Metric.
Constructor Details
#initialize(name, value, *thresholds) ⇒ Metric
Returns a new instance of Metric.
31 32 33 34 35 |
# File 'lib/whatthegem/stats/meters.rb', line 31 def initialize(name, value, *thresholds) @name = name @value = value @color = deduce_color(*thresholds) end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
29 30 31 |
# File 'lib/whatthegem/stats/meters.rb', line 29 def color @color end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
29 30 31 |
# File 'lib/whatthegem/stats/meters.rb', line 29 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
29 30 31 |
# File 'lib/whatthegem/stats/meters.rb', line 29 def value @value end |
Instance Method Details
#format ⇒ Object
37 38 39 |
# File 'lib/whatthegem/stats/meters.rb', line 37 def format '%20s: %s' % [name, colorized_value] end |