eddieroger
12/23/2006 5:45:00 AM
Not exactly what I did right, but I managed to get it. Basically, its
the same as before, but I replaced my get_movies and get_library with
this:
def get_library
@library
end
def get_movies
allmovies = Array.new
temp = get_library
temp = temp.root
temp.elements.each('items/movie') { |movie|
tempm = Movie.new(movie.attributes['uuid'].to_s,
movie.attributes['title'].to_s, movie.attributes['asin'].to_s,
movie.attributes['mpaarating'].to_s, movie.attributes['minutes'].to_s,
movie.attributes['published'].to_s, movie.attributes['price'].to_s)
allmovies << tempm
}
return allmovies
end
So, @movies isn't initialized any more, and I just return the array of
Movies to irb or whatever calls it. I realized that I needed it there
more anyway, and if i really want it automatically created, I'll just
set @movies = get_movies in the constructor. Also, notice the .to_s
after each attribute. I'm not sure if its necessary, but that's just
how it is for now. Thanks for the help, all.
Eddie