Video Review: Object Models
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
24 lines (17 sloc) 1.35 KB
Overview
This video gives an overview of object models and how to make our classes more powerful.
Objectives
Create a class and add reader and writer methods
Define class methods with an explicit
selfreceiverCapture new instances of
selfin theinitializemethodUse a class variable or constant to hold the instances of the class
Explain why we avoid using the
returnkeyword from within a loopDefine a
find_by_locationmethod to find a particular instance of a classAbstract the logic of the
find_by_locationmethod to adetectenumerable methodDefine a class method
find_all_by_locationto find all instances with that location using theselectenumerable methodDefine a custom constructor method to create instances from attributes scraped from a website
<iframe width="100%" height="720" src="https://www.youtube.com/embed/vENMFapLonA?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
Resources
Additional Video on Object Models
This video also covers many of the above topics in the main lesson video. Feel free to use this as another refresher on object models.
View OO Ruby Video Review: Object Models on Learn.co and start learning to code for free.
Last updated