Sha256: 714deb18a4ac91f7a72f75b25c4dfa22784116ab0b6d62bae1c4297de4a8a2da
Contents?: true
Size: 508 Bytes
Versions: 25
Compression:
Stored size: 508 Bytes
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Formatters class AbbreviatedNumberFormatter < NumberFormatter def truncate_number(number, decimal_digits) if TwitterCldr::DataReaders::NumberDataReader.within_abbreviation_range?(number) factor = [0, number.to_i.abs.to_s.length - decimal_digits].max number / (10.0 ** factor) else number end end end end end
Version data entries
25 entries across 25 versions & 3 rubygems