Hi --

On Sat, 4 Jul 2009, dzw! wrote:

> A.item =>  "var in A"
> B.item =>  "var in B"
>
> A.item='test'
>
> A.item =>  "test"
> B.item =>  "var in B"
>
> @@var ='ltl fkr'                #here is the funny part
>
> A.item         => "ltl fkr"
> B.item         => "ltl fkr"
>
> A.item='test'                  #and here is getting even funnier
>
> A.item         => "test"
> B.item         => "test"    # i wish it to stay 'ltl fkr'

The first time through I didn't even quite pick up on what you were
illustrating. (I think my brain interpolated class B < A because
that's what class variable questions usually involve :-)

This looks like a bug in 1.9 to me. I can't come up with any reason
why it should act like that -- the outer-scope part affecting the
class variables of A, those of A affecting those of B (without
inheritance), etc.

Even if remove_class_variable can help you, I would strongly recommend
not getting embroiled in that. I'd still advocate rewriting it to
avoid class variables.


David

-- 
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Now available: The Well-Grounded Rubyist (http://manning.com/black2)
Training! Intro to Ruby, with Black & Kastner, September 14-17
(More info: http://rubyurl.com/vmzN)