Class: AnyGood::Metric
- Inherits:
-
Object
- Object
- AnyGood::Metric
- Defined in:
- lib/any_good/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.
24 25 26 27 28 |
# File 'lib/any_good/meters.rb', line 24 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.
22 23 24 |
# File 'lib/any_good/meters.rb', line 22 def color @color end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/any_good/meters.rb', line 22 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
22 23 24 |
# File 'lib/any_good/meters.rb', line 22 def value @value end |
Instance Method Details
#format ⇒ Object
30 31 32 |
# File 'lib/any_good/meters.rb', line 30 def format '%20s: %s' % [name, colorized_value] end |