DEV Community

Discussion on: Translating Integers Into An English String in Ruby

Collapse
 
databasesponge profile image
MetaDave 🇪🇺

And a damn good exercise it is too.

We needed to translate integers from 0 to 100 into words for our system, and looked at a few gems, and thought about the logic, and then said "f*ck it" and just created a YAML file:

0: zero
1: one
2: two
...

Problem solved, and testing was pretty straightforward too!

Thread Thread
 
jennifer profile image
Jennifer Konikowski

I love it. Sometimes, if you have a limit like that, writing it out manually can be easier on a quick deadline! Especially if you need to support many languages.