Sha256: ae1c98107805132f440c4a2d931ef82c2f11a80eb106c51052f5ed7ef1d6078c
Contents?: true
Size: 768 Bytes
Versions: 1
Compression:
Stored size: 768 Bytes
Contents
module TwitterCldr module Formatters module Numbers class Fraction < Base attr_reader :format, :decimal, :precision def initialize(token, symbols = {}) @format = token ? token.value.split('.').pop : '' @decimal = symbols[:decimal] || '.' @precision = @format.length end def apply(fraction, options = {}) precision = options[:precision] || self.precision if precision > 0 decimal + interpolate(format(options), fraction, :left) else '' end end def format(options) precision = options[:precision] || self.precision precision ? '0' * precision : @format end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
twitter_cldr-1.0.0 | lib/formatters/numbers/helpers/fraction.rb |