June 2007
Intermediate to advanced
294 pages
8h 6m
English
I mentioned earlier that the commify method needs to vary based on how each country treats the notation of numbers. The area where this issue comes up most often is with currency, of course. The actual conversion process consists of relatively straightforward math, but we’ll use this script as a vehicle to set the stage for two important concepts introduced in our next script—notably the representation of data with either XML (eXtensible Markup Language, http://www.w3c.org/xml) or YAML (YAML Ain’t Markup Language, http://www.yaml.org). We’ll explore both XML and YAML further in the next script, but for now, let’s try out our current script in irb with irb -r currency_converter.rb.
irb(main):001:0> ...
Read now
Unlock full access