Complete Guide to Ruby
9h 18mIntermediate2024-12-12
Authors

Kevin Skoglund
Founder of NovaFabrica
Course details
Ruby, the popular object-oriented open-source programming language, is a great place to start learning programming or web development. You can use it to write interactive programs or to build scripts to speed up workflows and common tasks. In this course, instructor Kevin Skoglund covers everything new and experienced developers need to know to code with Ruby, from core object types and control structures to object-oriented programming with classes and modules. Along the way, Kevin outlines best practices and practical examples through a series of fun coding challenges. By the end of this course, you’ll be prepared to start coding in Ruby to define your own custom methods with loops and conditional logic.
Skills covered
RubyBack-End Web DevelopmentWeb DevelopmentProgramming LanguagesOpen SourceSoftware DevelopmentOne-Off
Concepts
Introduction
- Learn Ruby
- Using GitHub Codespaces
Get Started with Ruby
- Introducing Ruby
- Install Ruby
- Using Ruby
- Interactive Ruby Shell (IRB)
Ruby Object Types
- Objects
- Variables
- Numbers - Integers
- Numbers - Floats
- Strings
- Strings - Escaping and interpolation
- Arrays
- Array methods
- Hashes
- Symbols
- Booleans
- Ranges
- Constants
- Nil
- Challenge - Roman numerals
- Solution - Roman numerals
Control Structures
- About control structures
- Conditionals - if, else, elsif
- Conditionals - unless
- Conditionals - case
- Conditionals - Shorthand operators
- Loops
- Iterators
- Challenge - Blanket patterns
- Solution - Blanket patterns
Ruby Scripting
- Identifying Ruby code
- Exit a running script
- Input and output
- Challenge - Guessing game
- Solution - Guessing game
Dates and Times
- Time
- Date
- Challenge - Birthdate analysis
- Solution - Birthdate analysis
Enumerables and Code Blocks
- Enumerables
- Code blocks
- Find methods
- Map methods
- Inject methods
- Sort methods
- Merge methods
- Challenge - Ruby blanks
- Solution - Ruby blanks
Custom Methods
- Define and call methods
- Variable scope
- Arguments
- Argument default values
- Using a hash of options
- Return value
- Return multiple values
- Output vs. return values
- Challenge - Pig Latin
- Solution - Pig Latin
Classes
- Define a class
- Instances
- Attributes
- Reader writer methods
- Attribute methods
- Method access control
- Initialize method
- Challenge - Dice
- Solution - Dice
Class Attributes and Methods
- Class methods
- Class attributes
- Class reader and writer methods
- Challenge - Radio
- Solution - Radio
Inheritance
- Class inheritance
- Override and extend
- Access the superclass
- Challenge - Dungeon dice
- Solution - Dungeon dice
Modules
- Namespacing
- Mixins
- Load, require, and include
- Challenge - To-do list
- Solution - To-do list
Exceptions
- Handle exceptions
- Handle specific exceptions
- Exception methods
- Raise exceptions
- Custom exceptions
The File System
- Input output basics
- File system basics
- Types of file paths
- File permissions
Work with Files
- Access files
- Write to files
- Read from files
- File pointer
- Read or write an entire file
- Rename, delete, copy
- Examine file details
- Challenge - List maker
- Solution - List maker
Work with Directories
- Create directories
- Change directories
- Entries
- Glob
- Challenge - Treasure hunt
- Solution - Treasure hunt
Common Data Formats
- CSV
- YAML
- JSON
- XML
ERB Templating
- Embed Ruby
- Binding
- Template files
- Challenge - Mail merge
- Solution - Mail merge
Capstone Project
- Restaurant finder
- Project organization
- User input
- File storage
- List action
- Output
- Sort the list
- Find action
- Add action
- Completing the project
Conclusion
- Next steps