Closed LazySamir closed 6 years ago
Hey, you're pretty much spot on about extracting the string from the instance, if you pass the 'todo' object as an argument, you can return the string attributable to that instance by calling the 'text' method i.e. 'todo.text'; hence the 'add' method would look something like '@list << todo.text'. Hope that helps :)
I'm trying to figure out how to pass an instance of a new class as an argument to a method. I think the problem is that is that the 'Todo' class instance takes a string argument but when I pass an instance of the 'Todo' class as an argument to the 'add' method, it's the 'todo' object I'm passing, not the string argument.
So I think the problem is here: ` def add(todo)
something here to extract the string
end`
I was thinking that I need to add something here to extract the string from the 'todo' instance but I didn't see anything about this in the chapter so maybe I'm looking at the wrong thing.
I'm sure there is a very good lesson in data structure fundamentals here but my online searches haven't helped me learn it yet ha.