Sha256: 3a6d1ffb476cc84d0a15b0abfddbb424881dbc71c7b7326bdea54c4ff19301a2
Contents?: true
Size: 679 Bytes
Versions: 11
Compression:
Stored size: 679 Bytes
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Formatters class PercentFormatter < NumberFormatter DEFAULT_PERCENT_SIGN = "%" def format(number, options = {}) super(number, options).gsub('ยค', @tokenizer.symbols[:percent_sign] || DEFAULT_PERCENT_SIGN) end def default_format_options_for(number) { :precision => 0 } end def get_tokens(obj, options = {}) opts = options.dup.merge( :sign => obj.abs == obj ? :positive : :negative, :type => :percent ) @tokenizer.tokens(opts) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems