From: Giles Bowkett Date: 2006-05-15T15:44:16+09:00 Subject: Struct.new vs class 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 Please forgive my laziness, because I'm certain this is in Pickaxe, Why's Poignant Guide, Ruby In A Nutshell, "The Ruby Way," and a dozen other resources as well, most of which are either a bookshelf away or a Google away, but if anybody wants to just humor me, what's the best way to simplify this heinous, Java-esque code? Can I throw it in a Struct and then just extend initialize without losing any of the stuff Struct provides? The line with the comment "butt" is unavoidable (for now). -- Giles Bowkett http://www.gilesgoatboy.org