From: Mark Volkmann Date: 2006-05-15T21:43:20+09:00 Subject: Re: Struct.new vs class On 5/15/06, Logan Capaldo wrote: > > On May 15, 2006, at 2:44 AM, Giles Bowkett wrote: > > > OK, so I have this class and it could probably be a Struct. > > > > class Sample > > > > # I should probably turn this whole class into a simple > > Struct.new(etc.) statement > > > > attr :note_length, true > > attr :track, true > > attr :note, true > > attr :channel, true > > attr :threshold, true > > attr :notes, true > > > > def initialize(note_length, sequence, note, channel, threshold, > > notes) > > @note_length = note_length > > > > @track = Track.new(sequence) > > @track.sequence.tracks << @track # butt > > > > @note = note > > @channel = channel > > @threshold = threshold > > @notes = notes > > end > > > > end > > > > > > class Sample < Struct.new(:note_length, :sequence, :note, :channel, > etc.) > def initialize > super > # blah > end > end What is this supposed to do? It doesn't seem to allow me to create a Sample object and pass parameters to new. I think the OP wanted that. -- R. Mark Volkmann Object Computing, Inc.