Class: TwitterCldr::Formatters::DecimalFormatter
- Inherits:
-
NumberFormatter
- Object
- Base
- NumberFormatter
- TwitterCldr::Formatters::DecimalFormatter
- Defined in:
- lib/twitter_cldr/formatters/numbers/decimal_formatter.rb
Constant Summary
Constants inherited from NumberFormatter
NumberFormatter::DEFAULT_SYMBOLS
Instance Attribute Summary
Attributes inherited from NumberFormatter
Attributes inherited from Base
Instance Method Summary collapse
- #default_format_options_for(number) ⇒ Object
- #format(number, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ DecimalFormatter
constructor
A new instance of DecimalFormatter.
Constructor Details
#initialize(options = {}) ⇒ DecimalFormatter
Returns a new instance of DecimalFormatter.
9 10 11 12 |
# File 'lib/twitter_cldr/formatters/numbers/decimal_formatter.rb', line 9 def initialize( = {}) @tokenizer = TwitterCldr::Tokenizers::NumberTokenizer.new(:locale => self.extract_locale(), :type => :decimal) super end |
Instance Method Details
#default_format_options_for(number) ⇒ Object
20 21 22 |
# File 'lib/twitter_cldr/formatters/numbers/decimal_formatter.rb', line 20 def (number) { :precision => precision_from(number) } end |
#format(number, options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/twitter_cldr/formatters/numbers/decimal_formatter.rb', line 14 def format(number, = {}) super(number, ) rescue TypeError, ArgumentError number end |