Sha256: 9ca320a4001097f4cf4b57083e34017aa94a166c95e95e2411ec21f4c3ff5d24
Contents?: true
Size: 617 Bytes
Versions: 1
Compression:
Stored size: 617 Bytes
Contents
# encoding: UTF-8 module TwitterCldr module Formatters class DecimalFormatter < NumberFormatter def initialize(options = {}) @tokenizer = TwitterCldr::Tokenizers::NumberTokenizer.new(:locale => self.extract_locale(options), :type => :decimal) super end def format(number, options = {}) super(Float(number), options) rescue TypeError, ArgumentError number end protected def get_tokens(obj, options = {}) obj.abs == obj ? @tokenizer.tokens(:sign => :positive) : @tokenizer.tokens(:sign => :negative) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
twitter_cldr-1.0.1 | lib/formatters/numbers/decimal_formatter.rb |