Hi --

On Thu, 26 Jan 2006, Alex Combas wrote:

> I was fooling around with class variables tonight, and I know this is
> pretty silly, but forsome reason this code will work when in
> its own class, as you can see in class A and class B, but when I
> put the code together into class C I get an error
>
> class_vars.rb:26: undefined method `up=' for C:Class (NoMethodError)
>
> Can anyone explain why this is happening?
[...]
> puts "%s, %s" % (C.up,C.foo=10)

You need an array there: [C.up, C.foo=10].  The way you've got it,
what's happening is that it's being parsed as two assignments:

   C.up = 10
   C.foo = nil


David

-- 
David A. Black
dblack / wobblini.net

"Ruby for Rails", from Manning Publications, coming May 1, 2006!
http://www.manning.com/books/black