From: Robert Klemme Date: 2007-08-19T20:24:58+09:00 Subject: Re: Array Difference On 18.08.2007 01:05, Ken Bloom wrote: > On Fri, 17 Aug 2007 22:17:25 +0200, Robert Klemme wrote: >> If you need more methods you can use a block: >> >> Prova = Struct.new :n do >> def your_method(x) >> x + n >> end >> end > > Thanks for the tip, I've tried to do things like > > class Foo < Struct.new(:a,:b) > def method > end > end > > and while it works, it felt sorta hackish. If by "hackish" you mean that this creates one additional class then yes, sort of. Other than that it's ok, but I usually prefer the non inheritance version in these cases since only one class is needed. Kind regards robert