Robert Klemme
3/27/2008 7:33:00 PM
On 27.03.2008 16:28, Trans wrote:
>
> On Mar 27, 8:23 am, Florian Gilcher <f...@andersground.net> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On Mar 27, 2008, at 5:36 AM, Trans wrote:
>>
>>
>>
>>> And why can't #instance_variable_set take a hash to set more than one
>>> variable at a time?
>>> T.
>> By the way, if you really need it, it is easily implemented on your own:
>> Example:
>>
>> def set_instance_variables(variables)
>> variables.each do |key, value|
>> instance_variable_set("@#{key}", value)
>> end
>> end
>
> Yes, of course. Facets has #instance_assign, but it just seems
> wasteful when one method could do.
>
> 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)
How often is that really needed? I can remember only few cases where I
needed that - and those were probably more experimental.
Kind regards
robert