Sha256: d948aaba4fb844e1921a709abca21df618ea55bc193b7657f55a9c00270cffac
Contents?: true
Size: 648 Bytes
Versions: 2
Compression:
Stored size: 648 Bytes
Contents
require 'active_support' require 'active_support/number_helper' # for number_to_rounded module Squid module Format include ActiveSupport::NumberHelper def format_for(value, format) case format when :percentage then number_to_percentage value, precision: 1 when :currency then number_to_currency value when :seconds then number_to_minutes_and_seconds value when :float then number_to_delimited value else number_to_delimited value.to_i end.to_s end def number_to_minutes_and_seconds(value) "#{value.round / 60}:#{(value.round % 60).to_s.rjust 2, '0'}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
squid-1.0.0.beta2 | lib/squid/format.rb |
squid-1.0.0.beta1 | lib/squid/format.rb |