Ruby Essential Training Part 2: Classes and Modules
3h 2mBeginner2022-03-31
Authors

Kevin Skoglund
Founder of NovaFabrica
Course details
Once you understand the basics of Ruby, you can start creating custom classes and modules. These programming constructs make it easier to organize and maintain code and extend your applications with new features. In Ruby Essential Training 2, instructor Kevin Skoglund teaches the fundamentals of object-oriented programming with classes and modules. Learn how to define classes, the templates for creating object instances with their own unique behaviors and attributes. Discover how to use inheritance to share attributes and methods between a superclass and subclasses—and to extend or override them when necessary. Find out how to use modules as namespaces to prevent conflicts with other code, or as mixins to share functionality between classes. Kevin gives you step-by-step demonstrations, complete with examples and challenges that allow you to practice your new Ruby skills along the way.
Learning objectives
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
Learning objectives
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
Skills covered
RubyEssential TrainingProgramming LanguagesOpen SourceSoftware Development
Concepts
0. Introduction
- 01 - Learn to use custom classes in Ruby
- 02 - What you need to know
- 03 - Get the most out of the exercise files
1. Classes
- 04 - Define a class
- 05 - Instances
- 06 - Attributes
- 07 - Reader and writer methods
- 08 - Attribute methods
- 09 - Method access control
- 10 - Initialize method
- 11 - Challenge - Dice
- 12 - Solution - Dice
2. Class Attributes and Methods
- 13 - Class methods
- 14 - Class attributes
- 15 - Class reader and writer methods
- 16 - Challenge - Radio
- 17 - Solution - Radio
3. Inheritance
- 18 - Class inheritance
- 19 - Override and extend
- 20 - Access the superclass
- 21 - Challenge - Secure radio
- 22 - Solution - Secure radio
4. Dates and Times
- 23 - Time
- 24 - Date
- 25 - DateTime
- 26 - Challenge - Birthdate analysis
- 27 - Solution - Birthdate analysis
5. Modules
- 28 - Namespacing
- 29 - Mixins
- 30 - Load, require, and include
- 31 - Challenge - To-do list
- 32 - Solution - To-do list
6. Exceptions
- 33 - Handle exceptions
- 34 - Handle specific exceptions
- 35 - Exception methods
- 36 - Raise exceptions
- 37 - Custom exceptions
- 38 - Challenge - Custom exceptions
Conclusion
- 39 - Next steps