Sha256: c95418c4ad8e60c303a5adc49c42840fb53abc5b804efd5df12cef5655ee1494
Contents?: true
Size: 608 Bytes
Versions: 19
Compression:
Stored size: 608 Bytes
Contents
require 'infobar/trend' class Infobar::Rate 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 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
19 entries across 19 versions & 1 rubygems