From: Jeremy Bopp Date: 2010-10-25T03:16:36+09:00 Subject: Re: Utilizing data from a csv file On 10/24/2010 01:10 PM, Paul Roche wrote: > Jeremy Bopp wrote in post #956736: >> Try something even simpler: >> >> def make_array(items) >> new_items = [] >> items.each { |item| new_items << (item * 10) } >> new_items >> end >> >> these_items = [1, 2, 3, 4] >> those_items = make_array(these_items) >> >> >> After running this, what are the values of these_items and those_items? >> How does that change if you replace "new_items" with "items" everywhere >> in the make_array function? Why do you think that happens? From where >> is the value of "item" acquired in the make_array function? What >> happens if you change these_items as follows: >> >> these_items = ['1', '2', '3', '4'] > > Thanks Jermey, this example has helped. This did the trick...... > > def self.build_all(songs) > > new_items = [] > songs.each { |item| new_items << Song.new(item.name, item.owner) } > new_items > > end You're farther along, but you're still missing something important that would allow you to reduce this further. What are the kinds of items in the songs list you pass into the build_all method? Are they arrays of strings, numbers, or something else? -Jeremy