Sha256: 24e5ab6f02ad0f1a6d925656bbd6512ee397c3aba55f196899eec4a00de9e14d
Contents?: true
Size: 591 Bytes
Versions: 1
Compression:
Stored size: 591 Bytes
Contents
# encoding: UTF-8 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.1 | lib/formatters/numbers/percent_formatter.rb |