Sha256: e237fee237968147c0c8c800c75c08ae41f9e0011074f9389ce3549afc0350ba

Contents?: true

Size: 620 Bytes

Versions: 5

Compression:

Stored size: 620 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

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(number, options)
      rescue TypeError, ArgumentError
        number
      end

      def default_format_options_for(number)
        { :precision => precision_from(number) }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter_cldr-1.9.1 lib/twitter_cldr/formatters/numbers/decimal_formatter.rb
twitter_cldr-1.9.0 lib/twitter_cldr/formatters/numbers/decimal_formatter.rb
twitter_cldr-1.8.1 lib/twitter_cldr/formatters/numbers/decimal_formatter.rb
twitter_cldr-1.8.0 lib/twitter_cldr/formatters/numbers/decimal_formatter.rb
twitter_cldr-1.7.0 lib/twitter_cldr/formatters/numbers/decimal_formatter.rb