Class: WhatTheGem::Stats::Metric

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#colorObject (readonly)

Returns the value of attribute color.



29
30
31
# File 'lib/whatthegem/stats/meters.rb', line 29

def color
  @color
end

#nameObject (readonly)

Returns the value of attribute name.



29
30
31
# File 'lib/whatthegem/stats/meters.rb', line 29

def name
  @name
end

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

#formatObject



37
38
39
# File 'lib/whatthegem/stats/meters.rb', line 37

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