Jeremy Bopp wrote in post #956417:
> On 10/22/2010 03:10 PM, Paul Roche wrote:
>> end
>>
>>
>> I want to do the same thing using Song.list_add
>
> Your current list_add implementation is designed to allow you to add one
> Song instance at a time to the list.  It's not clear what you really
> want to do here.  Maybe what you want to do instead is remove your
> list_add method entirely and then have your list method simply return
> the list generated from ObjectSpace:
>
> def self.list
>   ObjectSpace.each_object(Song).to_a
> end
>
> With that in place, you wouldn't need to have the list_add method
> anymore.  Of course a much better solution is to have whatever you're
> using to load your CSV information call list_add for each Sing instance
> it creates.
>
> BTW, I downloaded your code earlier and tried to take a look at it.
> Aside from the fact that you really need to pick an indenting convention
> and stick to it (it will make your code *much* easier for others to
> read), I'm struck my your use of class variables all over the place.
> Why are you doing that, or more generally, what are you trying to
> accomplish overall?
>
> -Jeremy

Thanks for taking a look.


I acknowledge your points, particularly about indentation.
To be honest, this is school work, not an assigment, more take home work 
to experiment with, so the class variables are probably there for me to 
improve on it. Could you recommend how I change tese to local variables 
and make use of them? I'd like to stick with the list_add method. 
Overall I am implementing this to learn differnt aspects such as CSV 
files and mixin modules. So this could be considered the goal of the 
program. I'd like to keep away from objectspace. This is where I'm stuck 
at. I'm currently trying to utilize the list add method and .list. Again 
thanks for taking a look. I hope this has mad eit a bit clearere. Any 
advice would be welcomed

-- 
Posted via http://www.ruby-forum.com/.