From: Christian Neukirchen Date: 2005-06-08T01:31:52+09:00 Subject: Re: making a duck gabriele renzi writes: > Eric Mahurin ha scritto: > >> Is there another way to do this? With all of the talk about >> duck-typing, there would already be something out there to do >> this. > > There was some talk in the past about Object.new taking a block, which > imho would be useful for this. Meanwhile what about using Struct.new > with a block to define methods? Wow, this is nice... but where is it documented? I used to use code like this until now: class Foo < Struct.new(:all, :my, :fields) def mymethod # ... end end -- Christian Neukirchen http://chneukirchen.org