Hi I basically want to create a function that takes in data that has
been taken in from a csv file.
So I have this on my main file.......
songs = reader.read_in_songs(song_csv_file_name)
puts "\nBuilding Libraries..."
libs = Song.build_all(songs)
----------------------------------------------
here is the song class.........
class Song
attr_accessor :name, :owner
def initialize(name, owner)
@name = name
@owner = owner
end
def to_s
puts " #{@name} #{@owner}"
end
def self.build_all(songs)
## I want to be able to 'create song objects'(?) from the data taken in
from the csv file here
end
end
-------------------------------------------
Here is a rough idea I have so far, but it's returning nothing
songs = []
songs.each {|song| songs << Song.new(song.name, song.owner)}
-------------------------------
Do I have the right idea?
--
Posted via http://www.ruby-forum.com/.