Class: CalendariumRomanum::Ordinalizer

Inherits:
Object
  • Object
show all
Defined in:
lib/calendarium-romanum/ordinalizer.rb

Overview

Knows how to produce localized ordinals

Class Method Summary collapse

Class Method Details

.ordinal(number, locale: nil) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/calendarium-romanum/ordinalizer.rb', line 7

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