Like Rails' ordinalize method but with the ability to return the ordinal string spelled out in full words such as "first", "second", "third".
Features:
- i18n support
- doesn't monkey-patch
- easy to integrate with Rails but doesn't require Rails
- less than 50 lines of code
require "ordinalize_full/integer"
42.ordinalize_in_full #=> "forty second"
42.ordinalize_full #=> "forty second"
42.ordinalize(in_full: true) #=> "forty second"
42.ordinalize #=> "42nd"
I18n.locale = :fr
42.ordinalize_in_full #=> "quarante-deuxième"
42.ordinalize #=> "42ème"
require "ordinalize_full"
42.ordinalize_in_full #=> NoMethodError: undefined method `ordinalize_in_full' for 42:Fixnum
class MyIntegerLikeClass; include OrdinalizeFull; def to_s; "42"; end; end #=> :to_s
MyIntegerLikeClass.new.ordinalize_in_full #=> "forty second"
- only works up to 100 (for now)
- locales only available in English, French and Italian (pull requests welcome!)