Subject: Re: Quick way to copy data from super class into subclass?
From: Joel VanderWerf <joelvanderwerf@ a . m
Date: Tue, 23 Feb 2010 04:49:42 +0900
References: 357880
In-reply-to: 357880
Audrey A Lee wrote:
> Is there a quick way or idiom to copy the data from @your_hash into
> @my_hash?
Use Hash#update:
>> class MyHash < Hash; end
=> nil
>> h = {1=>2}
=> {1=>2}
>> mh = MyHash.new
=> {}
>> mh.update h
=> {1=>2}
>> mh.class
=> MyHash