From: swille Date: 2005-10-28T10:56:53+09:00 Subject: Re: "Reflecting" on my self.n00b On 10/27/05, Gregory Brown wrote: > For a little more clarification on usage: > > irb(main):027:0> class Foo > irb(main):028:1> def initialize() > irb(main):029:2> @url, @username, @password, @certificate, @owner = nil > irb(main):030:2> end > irb(main):031:1> attr_accessor :url, :username, :password, > :certificate, :owner > irb(main):032:1> end > => nil > irb(main):033:0> a = Foo.new > => # @owner=nil, @url=nil> > irb(main):034:0> a.url = "http://newhavenrubyists.org" > => "http://newhavenrubyists.org" > > and if you need to extend something > > irb(main):036:0> class Bar < Foo > irb(main):037:1> end > => nil > irb(main):038:0> b = Bar.new > => # @owner=nil, @url=nil> > irb(main):039:0> b.url = "http://stonecode.org/blog" > => "http://stonecode.org/blog" > > > How would I programatically find which instance variables I'm concerned with? The naming convention and the methods() call was my (probably weak) way of being able to find what needed to be populated. I'm not aware of how to search for instance variables. Can I?