Class: ICU4X::NumberFormat
- Inherits:
-
Object
- Object
- ICU4X::NumberFormat
- Defined in:
- lib/icu4x/yard_docs.rb
Overview
Formats numbers according to locale-specific conventions.
NumberFormat supports decimal, percent, and currency formatting with configurable grouping, fraction digits, and rounding.
Instance Method Summary collapse
-
#format(number) ⇒ String
Formats a number according to the configured options.
-
#format_to_parts(number) ⇒ Array<FormattedPart>
Formats a number and returns an array of parts.
-
#initialize(locale, provider: nil, style: :decimal, currency: nil, use_grouping: true, minimum_integer_digits: nil, minimum_fraction_digits: nil, maximum_fraction_digits: nil, rounding_mode: nil) ⇒ NumberFormat
constructor
Creates a new NumberFormat instance.
-
#resolved_options ⇒ Hash
Returns the resolved options for this instance.
Constructor Details
#initialize(locale, provider: nil, style: :decimal, currency: nil, use_grouping: true, minimum_integer_digits: nil, minimum_fraction_digits: nil, maximum_fraction_digits: nil, rounding_mode: nil) ⇒ NumberFormat
Creates a new NumberFormat instance.
465 466 467 468 |
# File 'lib/icu4x/yard_docs.rb', line 465 def initialize(locale, provider: nil, style: :decimal, currency: nil, use_grouping: true, minimum_integer_digits: nil, minimum_fraction_digits: nil, maximum_fraction_digits: nil, rounding_mode: nil); end |
Instance Method Details
#format(number) ⇒ String
Formats a number according to the configured options.
478 |
# File 'lib/icu4x/yard_docs.rb', line 478 def format(number); end |
#format_to_parts(number) ⇒ Array<FormattedPart>
For ‘style: :percent` and `style: :currency`, the current ICU4X experimental formatters do not provide part annotations. These styles return a single `:literal` part containing the entire formatted string.
Formats a number and returns an array of parts.
Each part contains a type and value, allowing for custom styling or processing of individual components.
504 |
# File 'lib/icu4x/yard_docs.rb', line 504 def format_to_parts(number); end |
#resolved_options ⇒ Hash
Returns the resolved options for this instance.
518 |
# File 'lib/icu4x/yard_docs.rb', line 518 def ; end |