Class: Plurimath::Formatter::Standard
- Inherits:
-
NumberFormatter
- Object
- NumberFormatter
- Plurimath::Formatter::Standard
- Defined in:
- lib/plurimath/formatter/standard.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ fraction_group_digits: 3, exponent_sign: "plus", fraction_group: "'", number_sign: "plus", notation: :basic, group_digits: 3, significant: 0, digit_count: 0, precision: 0, decimal: ".", group: ",", times: "x", e: "e", }.freeze
Instance Attribute Summary collapse
-
#precision ⇒ Object
Returns the value of attribute precision.
Attributes inherited from NumberFormatter
#locale, #localize_number, #localizer_symbols
Instance Method Summary collapse
-
#initialize(locale: "en", string_format: nil, options: {}, precision: nil) ⇒ Standard
constructor
A new instance of Standard.
- #set_default_options(options) ⇒ Object
Methods inherited from NumberFormatter
#localized_number, #twitter_cldr_reader
Constructor Details
#initialize(locale: "en", string_format: nil, options: {}, precision: nil) ⇒ Standard
Returns a new instance of Standard.
25 26 27 28 29 30 31 32 |
# File 'lib/plurimath/formatter/standard.rb', line 25 def initialize(locale: "en", string_format: nil, options: {}, precision: nil) super( locale, localize_number: string_format, localizer_symbols: (), precision: precision, ) end |
Instance Attribute Details
#precision ⇒ Object
Returns the value of attribute precision.
7 8 9 |
# File 'lib/plurimath/formatter/standard.rb', line 7 def precision @precision end |
Instance Method Details
#set_default_options(options) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/plurimath/formatter/standard.rb', line 34 def () = self.class::DEFAULT_OPTIONS self.precision ||= [:precision] ||= [:fraction_group_digits] ||= [:fraction_group_digits] [:fraction_group] ||= [:fraction_group] [:exponent_sign] ||= [:exponent_sign] [:group_digits] ||= [:group_digits] [:number_sign] ||= [:number_sign] [:significant] ||= [:significant] [:notation] ||= [:notation] [:decimal] ||= [:decimal] [:group] ||= [:group] [:times] ||= [:times] [:e] ||= [:e] end |