Finally, I have released my first module, Numbers::Ordinal! I already talked about its reasoning in a previous post, so I’m going to talk about the module itself!
Numbers::Ordinal provides two subs: &ordinal and &ordinal_digit. If you type ordinal(23), you get twenty-third, type ordinal_digit(23), and you get 23rd. Just a couple things about it:
&ordinal_digitdoesn’t exist yet.- Don’t use numbers higher than 999 in
&ordinal, or you’ll get something like-onetwo hundred thirty-fourthinstead ofone thousand, two hundred thirty-fourth. - the tests curiously refuse to run. Feel free to find the problem
Anyways, it’s bound to be useful, at least for test writers, and it’s available right here.