class Integer
def to_word(numbers)
1.to_word # => "one"
Turn a number into the word representation of that number.
def to_word(numbers) tmp = self / 1000 final = (self % 1000).hundred_to_word(2, numbers) place = 3 # special-case the tens and below until tmp.zero? final = (tmp % 1000).hundred_to_word(place, numbers) + ' ' + final place += 1 tmp /= 1000 end final == '' ? 'zero' : final.sub(/ and *$/, '').sub(/\s+$/, '') end