Class: AnyGood::Metric

Inherits:
Object
  • Object
show all
Defined in:
lib/any_good/meters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#colorObject (readonly)

Returns the value of attribute color.



22
23
24
# File 'lib/any_good/meters.rb', line 22

def color
  @color
end

#nameObject (readonly)

Returns the value of attribute name.



22
23
24
# File 'lib/any_good/meters.rb', line 22

def name
  @name
end

#valueObject (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

#formatObject



30
31
32
# File 'lib/any_good/meters.rb', line 30

def format
  '%20s: %s' % [name, colorized_value]
end