From: Robert Dober Date: 2008-03-29T06:04:17+09:00 Subject: Re: instance_variable_[gs]et 2008/3/27 Radosław Bułat : > On Thu, Mar 27, 2008 at 4:28 PM, Trans wrote: > > > I don't quite get matz take. How is > > > > > > variables.each do |key, value| > > instance_variable_set("@#{key}", value) > > end > > > > cleaner than > > > > instance_variable_set(variables) > > It won't but he didn't say that. And Florian Gilcher showed you that > you can write your own method that do it for you. I don't think that > Ruby should have built-in such a method. Using > instance_variable_[sg]et should be very rare (for example in > metaprogramming) and using such a loop even more. As a DSL implementor I could not disagree more with you, obviously there are many people who wrote the same code each { |k,v| ivar_set "@#{k}", v that would mean that it would be a nice feature to have, it would simply be the most DRY solution to the problem (or DROP in this case). Cheers Robert -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein