This video gives an overview of object models and how to make our classes more powerful.
- Create a class and add reader and writer methods
- Define class methods with an explicit
self
receiver - Capture new instances of
self
in theinitialize
method - Use a class variable or constant to hold the instances of the class
- Explain why we avoid using the
return
keyword from within a loop - Define a
find_by_location
method to find a particular instance of a class - Abstract the logic of the
find_by_location
method to adetect
enumerable method - Define a class method
find_all_by_location
to find all instances with that location using theselect
enumerable method - Define a custom constructor method to create instances from attributes scraped from a website
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.