Class: CalendariumRomanum::Ordinalizer
- Inherits:
-
Object
- Object
- CalendariumRomanum::Ordinalizer
- Defined in:
- lib/calendarium-romanum/ordinalizer.rb
Overview
Knows how to produce localized ordinals.
Used by Temporale for building names of Sundays and ferials.
Class Method Summary collapse
-
.ordinal(number, locale: nil) ⇒ String, Integer
Ordinal, or unchanged
number
ifOrdinalizer
cannot build ordinals for the given locale.
Class Method Details
.ordinal(number, locale: nil) ⇒ String, Integer
Returns ordinal, or unchanged number
if Ordinalizer
cannot build ordinals for the given locale.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/calendarium-romanum/ordinalizer.rb', line 16 def ordinal(number, locale: nil) locale ||= I18n.locale case locale when :cs "#{number}." when :en english_ordinal(number) when :fr french_ordinal(number) when :la, :it RomanNumerals.to_roman number else number end end |