From: Jim Bob Date: 2003-01-13T03:29:56+09:00 Subject: Re: Instance vars as arguments to initialize()? In article <3E20FCF6.8030405@chadfowler.com>, Chad Fowler wrote: > Another fun little Ruby-ism is that you could use "Struct" as a shortcut > for constructing the initializer as in the following example: > >====BEGIN==== > Blah = Struct.new("Blah", :a, :b, :c) > > class Blah > def extra_method > puts "Here's some non-instance-var behaviour" > end > end > > x = Blah.new("Hello World",Math::PI,["an", "array", "of", "strings"]) > x.extra_method #=> prints "Here's some non-instance-var behaviour" > puts x.a #=> prints "Hello World" >====END==== > > Chad > Very nice. I didn't even know the Struct class existed. Got to crack the books more often!