Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAnterrio Howard
2,625 PointsIn the Name class, create an attr_reader for the title instance variable
In the Name class, create an attr_reader for the title instance variable
class Name
def initialize(title, first_name, middle_name, last_name)
@title = title
@first_name = first_name
@middle_name = middle_name
@last_name = last_name
end
end
2 Answers
Ximena Castillo
1,387 Pointsclass Name attr_reader :title
def initialize(title, first_name, middle_name, last_name) @title = title @first_name = first_name @midde_name = middle_name @last_name = last_name end end
KRIS NIKOLAISEN
54,971 PointsThis is done in the previous video and shown in the teacher's notes for everything but title.
Adam Bonjoc
1,510 PointsAdam Bonjoc
1,510 PointsThanks! you are so cool!