chapter 3 from the ruby tutorial book