From: Gennady Bystritsky Date: 2006-01-26T14:43:21+09:00 Subject: Re: class variable weirdness ------_=_NextPart_001_01C6223B.60D0E309 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable If you just want to get to a class method from the instance, you can do a.class.foo=3D10 Gennady. -----Original Message----- From: Alex Combas [mailto:alex.combas@gmail.com] Sent: Wed 1/25/2006 20:20 To: ruby-talk ML Subject: Re: class variable weirdness =20 hi David On 1/25/06, dblack@wobblini.net wrote: > > Can anyone explain why this is happening? > [...] > > puts "%s, %s" % (C.up,C.foo=3D10) > > You need an array there: [C.up, C.foo=3D10]. The way you've got it, > what's happening is that it's being parsed as two assignments: > > C.up =3D 10 > C.foo =3D nil > Thanks I appreciate the quick reply, I think the () was a bit of python showing its roots. What I would like to do now is get instances of those classes and use = the methods that I've defined but I cant figure out how, without changing = the class. class A @@foo=3D1 def self.foo=3D(n) @@foo =3D n end end puts "%s" % A.foo=3D10 a =3D A.new #this does not work for an instance #puts "%s" % a.foo=3D10 -- Alex Combas http://noodlejunkie.blogspot.com/ ------_=_NextPart_001_01C6223B.60D0E309--