From: Rick DeNatale Date: 2009-02-27T10:53:01+09:00 Subject: Re: Instance Variable Names Available from Class? --001636164afda2d5d70463dcbd56 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Thu, Feb 26, 2009 at 2:59 PM, Chris Gardner wrote: > What I mean is that I would like to ask a class for the names of > instance variables of its objects, which may have yet to be > instantiated. > > class Foo > def intialize(bar, baz) > @bar = bar > @baz = baz > end > end > > I was trying to ask class Foo for the names @bar and @baz. I've found > out that these are accessible only through Foo instances. > > I'm a Ruby newbie and am just today learning about Ruby's approach to > metaprogramming. > http://talklikeaduck.denhaven2.com/articles/2008/02/08/whose-variable-is-it-anyway -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale --001636164afda2d5d70463dcbd56--