0.0
No commit activity in last 3 years
No release in over 3 years
Converts a number in range 1-99 (e.g. 1) to ordinal word (e.g. first) in Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

ordinal_word

Gem Version

Converts a number in range 1-99 (e.g. 1) to ordinal word (e.g. first) in Ruby. If not Integer in range [1..99] is passed as an argument, raises OrdinalWordError with appropriate message, otherwise returns string.

Installation

$ gem install ordinal_word

Usage

require 'ordinal_word'

Examples

OrdinalWord.wordinalize(1)      # 'first'
OrdinalWord.wordinalize(13)     # 'thirteenth'
OrdinalWord.wordinalize(99)     # 'ninety-ninth'
OrdinalWord.wordinalize('str')  # OrdinalWord::OrdinalWordError: Argument is not an Integer.
OrdinalWord.wordinalize(0)      # OrdinalWord::OrdinalWordError: Number is less than 1.