On Wed, Mar 3, 2010 at 8:13 PM, Evan Hanson <vnhnsn / gmail.com> wrote: > As an aside, can anyone tell me if there is a slick Ruby way to do > what is done in cases like my Key#names, Chord#names, Chord#to_s, etc. > functions, where you're just mapping things from one array to another, > or from one array to a string, etc? > def names > notes = [] > @notes.each { |n| notes.push n.name } > notes > end def names @notes.map {|n| n.name} end > def to_s > out = "" > names.each { |n| out += n + " " } > out.strip! > end def to_s names.join(" ") end Jesus.