From: Chris Morris Date: 2004-10-01T13:42:45+09:00 Subject: Re: Can you rewrite this in a better way? > Is there a better way (more efficient, shorter and/or clearer) to do this? What about this: ---------------------------------------------- Object#instance_variables obj.instance_variables -> anArray ------------------------------------------------------------------------ Returns an array of instance variable names for the receiver. Note that simply defining an accessor does not create the corresponding instance variable. class Fred attr_accessor :a1 def initialize @iv = 3 end end Fred.new.instance_variables #=> ["@iv"] -- Chris http://clabs.org