From: Robert Klemme Date: 2007-09-04T22:39:43+09:00 Subject: Re: Struct is cleverer than the documentation claims 2007/9/4, Paul Brannan : > On Tue, Sep 04, 2007 at 07:01:15PM +0900, Paul Butcher wrote: > > > Customer = Struct.new(:name, :address) do > > > def to_s > > > "Customer called '#{name}' living at '#{address}'" > > > end > > > end > > > > > class Customer < Struct.new(:name, :address) > > > def to_s > > > "Customer called '#{name}' living at '#{address}'" > > > end > > > end > > Why not reopen the class? > > Customer = Struct.new(:name, :address) > class Customer > def to_s > "Customer called '#{name}' living at '#{address}'" > end > end Why should I reopen a class if I can have everything with the block? Customer = Struct.new :name, :address do def to_s "Customer called '#{name}' living at '#{address}'" end end Kind regards robert