Join Kevin Skoglund for an in-depth discussion in this video Attribute methods, part of Ruby: Classes and Modules.
- [Instructor] Now that we understand about attributes,…and we understand about reader and writer methods,…we're ready to learn about attribute methods.…Attribute methods are sometimes…called attr underscore asterisk methods.…And the reason why is that asterisk…is a placeholder for the…three different types of methods that we can have.…We can have attribute reader, attribute writer,…or attribute accessor methods.…They all start with attr underscore,…and then either reader, writer, accessor.…And when you say them out loud,…you typically say, attributer, attribute writer,…attribute accessor, even though you don't type…all of it out.…
So the way that we would use them,…is inside our class we could have the attribute reader,…and then a symbol for the name…of the attribute that we want to make readable.…If the exact same thing as if we added…that definition to our class,…that we just saw in the last movie,…where we used noise and we returned…the value of the instance variable noise.…This is just a way to write the same thing on one line,…
- Defining a custom class
- Working with instances of a class
- Class and instance attributes and methods
- Class inheritance
- Working with dates and times
- Using modules as namespaces and mixins
- Raising and handling exceptions
Skill Level Beginner
2. Class Attributes and Methods
4. Dates and Times
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.