Sha256: e5282410a50fb4cae569766b1fae489e9c5342e0b307386906b7e02c09669e8b
Contents?: true
Size: 547 Bytes
Versions: 2
Compression:
Stored size: 547 Bytes
Contents
require 'infobar/trend' class Infobar::Rate def initialize(value, fifo_values = [], **opts) opts[:format] = add_trend(opts[:format], fifo_values) @string = if opts[:format].include?('%U') Tins::Unit.format(value, **opts) else opts[:format] % value end end def to_s @string end private def add_trend(format, fifo_values) if fifo_values.empty? format.gsub('%t', ?⤿) else trend = Infobar::Trend.new(fifo_values) format.gsub('%t', trend.to_s) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
infobar-0.0.3 | lib/infobar/rate.rb |
infobar-0.0.2 | lib/infobar/rate.rb |