Class: Infobar::Rate

Inherits:
Object show all
Defined in:
lib/infobar/rate.rb

Instance Method Summary collapse

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_sObject



16
17
18
# File 'lib/infobar/rate.rb', line 16

def to_s
  @string
end