From: Austin Ziegler Date: 2004-02-20T05:12:56+09:00 Subject: Re: Change to #new (was OpenStruct#initialize to yield self) On Fri, 20 Feb 2004 02:42:00 +0900, Dave Thomas wrote: > On Feb 19, 2004, at 6:50, Gavin Sinclair wrote: >> This is a common approach I use to object initialization; I don't know >> about other people. Thought it was worth mentioning it here. It >> allows code like the following: >> >> record = OpenStruct.new do |r| >> r.name = "John Smith" >> r.age = 70 >> r.pension = 300 >> end > As more general suggestion. Could 'new' yield the new object is a block > is given? This behavior could then be overridden by the classes where > this isn't appropriate (such as hash). How would it be overridden? -austin -- austin ziegler * austin@halostatue.ca * Toronto, ON, Canada software designer * pragmatic programmer * 2004.02.19 * 15.12.03