From: Greg Weeks Date: 2007-11-18T07:20:10+09:00 Subject: Re: eval, module_eval, define_method, and all that I wrote above that my head was swimming. Not enough, evidentally: If I want my_attr_reader to handle multiple attributes, this works: def my_attr_reader *names names.each do |name| # THIS IS THE ONLY LINE THAT DIFFERS define_method name do instance_variable_get "@"+name.to_s end end end But this doesn't: def my_attr_reader *names for name in names # THIS IS THE ONLY LINE THAT DIFFERS define_method name do instance_variable_get "@"+name.to_s end end end Ouch. -- Posted via http://www.ruby-forum.com/.