June 2007
Intermediate to advanced
294 pages
8h 6m
English
In previous scripts, notably #16 Adding Commas to Numbers (commify.rb) on page 75 and #17 Roman Numerals (roman_numeral.rb) on page 81, we talked about how numbers can be represented in a variety of ways. Both of those scripts showed meaningful ways of representing Integers as Strings, other than the handy but trivially different to_s method. This script, to_lang.rb, extends that discussion by representing Integers as Strings consisting of how those numbers are spoken in two real-world languages: English and Spanish.
This code is broken into three separate files, for reasons that I will make clear in How It Works on page 198.
=begin rdoc This is intended for use with to_lang.rb ...
Read now
Unlock full access