Class: Infobar::Rate
Instance Method Summary collapse
-
#initialize(value, fifo_values = [], **opts) ⇒ Rate
constructor
A new instance of Rate.
- #to_s ⇒ Object
Constructor Details
#initialize(value, fifo_values = [], **opts) ⇒ Rate
Returns a new instance of Rate.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/infobar/rate.rb', line 4 def initialize(value, fifo_values = [], **opts) opts[:format] ||= '%.3f%U%t' opts[:format] = add_trend(opts[:format], fifo_values) @string = value.full? do if opts[:format].include?('%U') Tins::Unit.format(value, **opts) else opts[:format] % value end end.to_s end |
Instance Method Details
#to_s ⇒ Object
16 17 18 |
# File 'lib/infobar/rate.rb', line 16 def to_s @string end |