----- Original Message ----- From: Pat Eyler <pate / networkinglinuxbook.com> To: ruby-talk ML <ruby-talk / ruby-lang.org> Sent: Tuesday, September 04, 2001 2:15 PM Subject: [ruby-talk:20885] Re: newbie question > On 05 Sep 2001 03:48:48 +0900, Ned Konz wrote: > > On Tuesday 04 September 2001 11:18 am, Pat Eyler wrote: > > > I never did translate: > > > > > > public class Movie { > > > public static final int CHILDREN = 2; > > > public static final int REGULAR = 0; > > > public static final int NEW_RELEASE = 1; > > > } > > > > > > into ruby, instead I just used the magic numbers 0, 1, and 2 as needed > > > in methods of other classes and ignored it figuring I would have a > > > blinding flash of the obvious and go back and fix things. As can be > > > expected, the blinding flash never came. > > > > > > Would someone mind enlightening me? > > > > class Movie > > CHILDREN = 2 > > REGULAR = 0 > > NEW_RELEASE = 1 > > # ... > > end > > I'd tried this, but it fails when I try to use the values outside a > Movie (see the class Price hierarchy) in the code below. This probably > means that I'm doing something else wrong... [snip] Use Movie::REGULAR rather than Movie.REGULAR -- Ruby thinks it's a method call otherwise. Hal