From: Avdi Grimm Date: 2008-03-04T07:55:32+09:00 Subject: Re: Question on the Ruby Programming Language Book On Mon, Mar 3, 2008 at 5:44 PM, Bharat Ruparel wrote: > 1 Why do you have to create enumerated objects this way? This seems a > long way off from Ruby's philosophy of being succint. Just to define a > few "object" constants I have to go through this? In general, Ruby programmers don't create enumerated objects. There's rarely a need for them. The solution you demonstrated above is looks like an example of how one might go about it if one really wanted to emulate C++-style enumerations. Generally you would just use symbols, though. > The block is apparently setting the "name" to the "instance". What does > this buy us from a programming point of view? That's the part that actually creates those constants Season::Summer, Season::Autumn, etc. Without it they would not exist. -- Avdi