Ruby Ruby Objects and Classes Variables and Methods Variables

For me, this code doesn't pass unless you pass in the new 4 parameters?

For me, if I update this line to: def initialize(title, first_name, middle_name, last_name)

and instantiate like this: name = Name.new("Mr.")

I get an error that there are 3 parameters missing.

You need to do this: name = Name.new("Mr.", "Barack","H","Obama") or equivalent yes?

How is it passing in the video?

4 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,432 Points

Notice there's a cutscene where Jason changed the fixed return values into instance variables. I assume he also changed his Name.new statement at the bottom of the file as well to include all the attributes, we just don't see that. Yes, it needs to be passed 4 arguments, just like the initialize method suggests.

Thank you

There has to be a better way to present this video.

MICHAEL P
MICHAEL P
5,190 Points

I find that the way that the video jumps around to be confusing. I remember a teacher stating in high school, that if the teacher shows the wrong way of doing something, that the mistake will be what the student learns. Unnecessarily confusing!

Andrew Mayne
Andrew Mayne
5,850 Points

This video jumps too much. If you do exactly as he says it won't pass.