Skip to content

Instantly share code, notes, and snippets.

@geelen geelen/gist:36960

forked from benhoskings/gist:36955
Created Dec 17, 2008
What would you like to do?
def number_to_ordinal num
int = num.to_i
int.to_s + ((10...20) === int) ? "th" : (%w{th st nd rd}[int % 10] or "th")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.