Module: ICU::DurationFormatting
- Defined in:
- lib/ffi-icu/duration_formatting.rb
Defined Under Namespace
Classes: DurationFormatter
Constant Summary collapse
- VALID_FIELDS =
%i[ years months weeks days hours minutes seconds milliseconds microseconds nanoseconds ]
- HMS_FIELDS =
%i[ hours minutes seconds milliseconds microseconds nanoseconds ]
- ROUNDABLE_FIELDS =
%i[ seconds milliseconds microseconds nanoseconds ]
- VALID_STYLES =
%i[long short narrow digital]
- STYLES_TO_LIST_JOIN_FORMAT =
{ long: :wide, short: :short, narrow: :narrow, digital: :narrow, }
- UNIT_FORMAT_STRINGS =
{ years: 'measure-unit/duration-year', months: 'measure-unit/duration-month', weeks: 'measure-unit/duration-week', days: 'measure-unit/duration-day', hours: 'measure-unit/duration-hour', minutes: 'measure-unit/duration-minute', seconds: 'measure-unit/duration-second', milliseconds: 'measure-unit/duration-millisecond', microseconds: 'measure-unit/duration-microsecond', nanoseconds: 'measure-unit/duration-nanosecond', }
- STYLES_TO_NUMBER_FORMAT_WIDTH =
{ long: 'unit-width-full-name', short: 'unit-width-short', narrow: 'unit-width-narrow', # digital for hours:minutes:seconds has some special casing. digital: 'unit-width-narrow', }
Class Method Summary collapse
Class Method Details
.format(fields, locale:, style: :long) ⇒ Object
56 57 58 |
# File 'lib/ffi-icu/duration_formatting.rb', line 56 def self.format(fields, locale:, style: :long) DurationFormatter.new(locale: locale, style: style).format(fields) end |