Class: Treat::Workers::Inflectors::Ordinalizers::Linguistics

Inherits:
Object
  • Object
show all
Defined in:
lib/treat/workers/inflectors/ordinalizers/linguistics.rb

Overview

This class is a wrapper for the functions included in the ‘linguistics’ gem that allow to describe a number in words in ordinal form.

Project website: deveiate.org/projects/Linguistics/

Constant Summary collapse

DefaultOptions =
{
  :language => Treat.core.language.default
}

Class Method Summary collapse

Class Method Details

.ordinal(entity, options = {}) ⇒ Object

Desribe a number in words in ordinal form, using the ‘linguistics’ gem.



14
15
16
17
18
19
# File 'lib/treat/workers/inflectors/ordinalizers/linguistics.rb', line 14

def self.ordinal(entity, options = {})
  options = DefaultOptions.merge(options)
  lang = entity.language
  code = Treat::Loaders::Linguistics.load(lang)
  entity.to_s.send(code).ordinate
end