On 18.01.2007 21:25, Kalman Noel wrote:
> David Chelimsky:
>> One thing I'd love to see in a future version of ruby is this;
>>
>> def initialize(@thing, @other)
>> end
> 
> Try the following.  Note that it does not actually set @thing and @other
> - they are only accessible methodically - but gives you an appropriate
> #initialize.
> 
> Klass = Struct.new(:thing, :other)
> class Klass
> 
>   # more
> 
> end

You can even do

Klass = Struct.new :foo, :bar do
   def some_method
   end
end

which I find pretty nice. :-)

	robert