Sha256: 68c7c6a1990bf5c065dd8832d1989a59810c4cc5b41a8e8019cb778f77882463
Contents?: true
Size: 572 Bytes
Versions: 1
Compression:
Stored size: 572 Bytes
Contents
module TwitterCldr module Formatters class PercentFormatter < NumberFormatter DEFAULT_PERCENT_SIGN = "%" DEFAULT_FORMAT_OPTIONS = { :precision => 0 } def initialize(options = {}) @tokenizer = TwitterCldr::Tokenizers::NumberTokenizer.new(:locale => self.extract_locale(options), :type => :percent) super end def format(number, options = {}) opts = DEFAULT_FORMAT_OPTIONS.merge(options) super(number, opts).gsub('ยค', @tokenizer.symbols[:percent_sign] || DEFAULT_PERCENT_SIGN) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
twitter_cldr-1.0.0 | lib/formatters/numbers/percent_formatter.rb |