English Number Converter in Ruby

This converter will take in any number and return the number in english words.

# Sorting array of Words

def english_numbers number
  if number < 0 # No negitive numbers
    return 'Please enter a number that isn\'t negitive.'
  end

  if number == 0
    return 'zero'
  end

  num_string = ''
  one_places = ['one', 'two', 'three',
                'four', 'five', 'six',
                'seven', 'eight', 'nine']

  tens_place = ['ten', 'twenty', 'thirty',
                'forty', 'fifty', 'sixty',
                'seventy', 'eighty', 'ninety']

  teenagers  = ['eleven', 'twelve', 'thirteen',
                'fourteen', 'fifteen', 'sixteen',
                'seventeen', 'eighteen', 'nineteen']

  zillions   = [['hundred',              2],
                ['thousands',            3],
                ['million',              6],
                ['billion',              9],
                ['trillion',            12],
                ['quadrillion',         15],
                ['quintillion',         18],
                ['sextillion',          21],
                ['octillion',           24],
                ['nonillion',           27],
                ['decillion',           30],
                ['undecillion',         33],
                ['duodecillion',        36],
                ['tredecillion',        39],
                ['tredecillion',        42],
                ['quatturodecillion',   45],
                ['quindecillion',       48],
                ['sexdecillion',        51],
                ['septendecillion',     54],
                ['octodecillion',       57],
                ['novemdecillion',      60],
                ['vigintillion',        63],
                ['googol',             100]]

  # "left" is how much of the number we still have to write out
  # "write" is the part we are writing out

  left = number

  while zillions.length > 0
    zil_pair = zillions.pop
    zil_name = zil_pair[0]
    zil_base = 10 ** zil_pair[1]

    write = left/zil_base         # How many zillions left?
    left  = left - write*zil_base # Subtract off the zillions

    if write > 0
      prefix = english_numbers write
      num_string = num_string + prefix + ' ' + zil_name

      if left > 0
        num_string = num_string + ' '
      end
    end
  end

  write = left/10            # How many tens left
  left  = left - write*10    # Subtract off the tens

  if write > 0
    # Since we can't write "tenty-two" instead of
    # twelve, we have to make a special exception for these.
    if ((write == 1) and (left > 0))
      num_string = num_string + teenagers[left-1]
      # The "-1" is because teenagers[3] is 'fourteen', not 'thirteen'
      left = 0
    else
      num_string = num_string + tens_place[write-1]
      # The "-1" is because tens_place[3] is 'forty' not 'thirty'
    end

    if left > 0
      # So we don't write 'sixtyfour'
      num_string = num_string + ' '
    end
  end

  write = left      # How many ones to write
  left  = 0         # Subtract the ones

  if write > 0
    num_string = num_string + one_places[write-1]
    # The "-1" is because one_places[3] is 'four', not 'three'
  end

  num_string
end

# Test the method
puts english_numbers(   0)
puts english_numbers(   9)
puts english_numbers(  10)
puts english_numbers(  11)
puts english_numbers(  17)
puts english_numbers(  32)
puts english_numbers(  88)
puts english_numbers(  99)
puts english_numbers( 100)
puts english_numbers( 101)
puts english_numbers( 234)
puts english_numbers(3211)
puts english_numbers(999999)
puts english_numbers(100000000000000000)
puts english_numbers(123456789874545854581235845)

#=> output

#zero
#nine
#ten
#eleven
#seventeen
#thirty two
#eighty eight
#ninety nine
#one hundred
#one hundred one
#two hundred thirty four
#three thousands two hundred eleven
#nine hundred ninety nine thousands nine hundred ninety nine
#one hundred quadrillion
#one hundred twenty three octillion four hundred fifty six sextillion seven hundred eighty nine quintillion eight hundred seventy four quadrillion five hundred forty five trillion eight hundred fifty four billion five hundred eighty one million two hundred thirty five thousands eight hundred forty five