Welcome to Advanced Ruby!

Ready to take your Ruby skills to the next level? Whether you've solid coding experience, or are looking to deepen your Ruby expertise, this course is designed for you.

We'll dive deep into advanced concepts, giving you the tools to write more efficient, powerful, and elegant code.

Advanced Ruby is perfect for those who are comfortable with the basics and want to unlock the full potential of Ruby.

By the end of this course, you'll be able to tackle complex projects and bring your ideas to life with clean, advanced Ruby code.
Welcome to Advanced Ruby!

Ready to take your Ruby skills to the next level? Whether you've solid coding experience, or are looking to deepen your Ruby expertise, this course is designed for you.

We'll dive deep into advanced concepts, giving you the tools to write more efficient, powerful, and elegant code.

Advanced Ruby is perfect for those who are comfortable with the basics and want to unlock the full potential of Ruby.

By the end of this course, you'll be able to tackle complex projects and bring your ideas to life with clean, advanced Ruby code.

Get the Advanced Ruby course

Module 1: Why Learn Advanced Concepts in Ruby?

Solve Problems Better

Write Faster, Better Code

Boost Your Career

Rails Mastery

Module 2: The Ruby Object Model

Everything inherits from Object

Understanding the ancestors chain

Role of BasicObject

Importance of Kernel

Object as an interface

Mastering the Ruby Object Model

Module 3: The Ancestor Chain

ancestors method returns the ancestor chain as an array

Understanding the ancestor chain order

Using superclass to find the parent class

Finding included modules with included_modules

Method resolution through the ancestor chain

Module 4: The Main Object in Ruby

main object is an instance of Object

Top-level scope of any Ruby program

Accessing methods in the main object

Changes in Ruby 2.7 for private methods

Module 5: Inheritance in Ruby

Basic inheritance using <

No multiple inheritance in Ruby

Calling parent class methods in a subclass

Overriding methods in a subclass

Using super to call parent methods

Dynamic class inheritance with []

Using the inherited hook method

Module 6: The super Keyword

Implicit arguments with super

Difference between super and super()

Using super with blocks

super and the ancestor chain

Module 7: Message, Receiver, and Message Handler

Components of a Ruby message: name and payload

Receiver: The object that responds to the message

Sending a message with Kernel#send

Message sender: The calling object context

Module 8: Access Control in Ruby

Public methods: Accessible from anywhere

Private methods: Respond to messages with implicit receiver

Protected methods: Accessible by same-family objects

Using Kernel#send to bypass access control

Private method changes in Ruby 2.7+

Module 9: Classes Behind the Scenes

Using the class keyword to define a class

Defining a class with Class.new

Anonymous classes in Ruby

Inheritance with Class.new

Understanding classes as instances of Class

Module 10: Eigenclass

Eigenclass: An unnamed instance of the class Class

Accessing the eigenclass with class << self

Singleton methods as instance methods of the eigenclass

Eigenclass inheritance from the Object eigenclass

Defining singleton methods with self.method_name

Module 11: Module Behind the Scenes

Defining a module with Module.new

Understanding anonymous modules

Relationship between Module and Class

Key differences between classes and modules

Module 12: Ruby Hook Methods

Using Module#included, Module#extended, and Module#prepended

Understanding Class#inherited

Caution with hook methods: Avoid undesired side effects

Module 13: method_missing

Intercepting calls to undefined methods with method_missing

Understanding the method lookup path

Default behavior of method_missing: Raising NoMethodError

Caution when overriding method_missing: Potential debugging challenges

Module 14: module_function vs extend self

Making instance methods available as module methods

The key difference between module_function and extend self

Overriding a method defined with module_function

Module 15: COMPACT vs NESTED Class Definition

Understanding the impact of lexical scope and constant lookup

Avoiding uninitialized constant errors in compact style

Understanding constant lookup in nested style

Choosing nested style for correct constant lookup in nested modules

Module 16: class_eval vs module_eval

Adding methods to a class using class_eval

Using module_eval to evaluate code in a module context

Evaluating blocks in the context of a class

The key difference between class_eval and module_eval

Module 17: Method Aliasing

Creating method aliases with the alias keyword

Using alias_method to create method aliases with method syntax

Handling scope differences between alias and alias_method

Understanding how Ruby stores methods and their aliases

Module 18: require vs require_relative

Understanding the expectations of Kernel#require for absolute paths

Using require_relative to load files relative to the current file

Leveraging $LOAD_PATH and $LOADED_FEATURES with Kernel#require

Avoiding reloading of files already in $LOADED_FEATURES

Module 19: Blocks and the yield Keyword

Using yield to execute blocks passed to methods

Checking for block presence with Kernel#block_given?

Passing arguments to blocks via yield

Implementing Array#my_map with custom block handling

Module 20: Procs, Lambdas & Closures

Understanding how to define and use Procs and Lambdas in Ruby

Recognizing the differences in argument handling between Procs and Lambdas

How Procs and Lambdas handle the return statement differently

Understanding closures and how Procs and Lambdas capture context

MINI-PROJECTS

Completing a course alone isn't enough to master advanced Ruby concepts.

You need to apply your knowledge to a structured codebase, giving you real-world experience in how professional Ruby projects are organized.

That's why we've added two exciting mini-projects to complement our Advanced Ruby course:

1. MyRake

In this project, you'll apply Ruby concepts by creating a command-line tool that mimics the basic functionality of Rake, a task automation tool.

It's important to complete this mini-project after the Advanced Ruby course to reinforce your knowledge and learn how to structure a Ruby codebase similar to a production-ready gem.

By the end of this project, you will have a solid understanding of how to create a simple task automation tool, similar to Rake, using Ruby.

2. MyInteractor

In this project, you'll apply Ruby concepts by creating a basic version of the popular interactor gem.

This is an excellent way to practice Advanced Ruby skills and learn how to structure a Ruby codebase similar to a production-ready gem.

By the end of this project, you will be proficient in creating an interactor pattern for handling business logic in Ruby applications.

You will learn to manage context using OpenStruct, handle custom errors, and implement argument forwarding.

This project will also enhance your skills in structuring a Ruby codebase and creating modular, reusable code.

Module 1: Why Learn Advanced Concepts in Ruby?

Solve Problems Better

Write Faster, Better Code

Boost Your Career

Rails Mastery

Module 2: The Ruby Object Model

Everything inherits from Object

Understanding the ancestors chain

Role of BasicObject

Importance of Kernel

Object as an interface

Mastering the Ruby Object Model

Module 3: The Ancestor Chain

ancestors method returns the ancestor chain as an array

Understanding the ancestor chain order

Using superclass to find the parent class

Finding included modules with included_modules

Method resolution through the ancestor chain

Module 4: The Main Object in Ruby

main object is an instance of Object

Top-level scope of any Ruby program

Accessing methods in the main object

Changes in Ruby 2.7 for private methods

Module 5: Inheritance in Ruby

Basic inheritance using <

No multiple inheritance in Ruby

Calling parent class methods in a subclass

Overriding methods in a subclass

Using super to call parent methods

Dynamic class inheritance with []

Using the inherited hook method

Module 6: The super Keyword

Implicit arguments with super

Difference between super and super()

Using super with blocks

super and the ancestor chain

Module 7: Message, Receiver, and Message Handler

Components of a Ruby message: name and payload

Receiver: The object that responds to the message

Sending a message with Kernel#send

Message sender: The calling object context

Module 8: Access Control in Ruby

Public methods: Accessible from anywhere

Private methods: Respond to messages with implicit receiver

Protected methods: Accessible by same-family objects

Using Kernel#send to bypass access control

Private method changes in Ruby 2.7+

Module 9: Classes Behind the Scenes

Using the class keyword to define a class

Defining a class with Class.new

Anonymous classes in Ruby

Inheritance with Class.new

Understanding classes as instances of Class

Module 10: Eigenclass

Eigenclass: An unnamed instance of the class Class

Accessing the eigenclass with class << self

Singleton methods as instance methods of the eigenclass

Eigenclass inheritance from the Object eigenclass

Defining singleton methods with self.method_name

Module 11: Module Behind the Scenes

Defining a module with Module.new

Understanding anonymous modules

Relationship between Module and Class

Key differences between classes and modules

Module 12: Ruby Hook Methods

Using Module#included, Module#extended, and Module#prepended

Understanding Class#inherited

Caution with hook methods: Avoid undesired side effects

Module 13: method_missing

Intercepting calls to undefined methods with method_missing

Understanding the method lookup path

Default behavior of method_missing: Raising NoMethodError

Caution when overriding method_missing: Potential debugging challenges

Module 14: module_function vs extend self

Making instance methods available as module methods

The key difference between module_function and extend self

Overriding a method defined with module_function

Module 15: COMPACT vs NESTED Class Definition

Understanding the impact of lexical scope and constant lookup

Avoiding uninitialized constant errors in compact style

Understanding constant lookup in nested style

Choosing nested style for correct constant lookup in nested modules

Module 16: class_eval vs module_eval

Adding methods to a class using class_eval

Using module_eval to evaluate code in a module context

Evaluating blocks in the context of a class

The key difference between class_eval and module_eval

Module 17: Method Aliasing

Creating method aliases with the alias keyword

Using alias_method to create method aliases with method syntax

Handling scope differences between alias and alias_method

Understanding how Ruby stores methods and their aliases

Module 18: require vs require_relative

Understanding the expectations of Kernel#require for absolute paths

Using require_relative to load files relative to the current file

Leveraging $LOAD_PATH and $LOADED_FEATURES with Kernel#require

Avoiding reloading of files already in $LOADED_FEATURES

Module 19: Blocks and the yield Keyword

Using yield to execute blocks passed to methods

Checking for block presence with Kernel#block_given?

Passing arguments to blocks via yield

Implementing Array#my_map with custom block handling

Module 20: Procs, Lambdas & Closures

Understanding how to define and use Procs and Lambdas in Ruby

Recognizing the differences in argument handling between Procs and Lambdas

Exploring how Procs and Lambdas handle the return statement differently

Understanding closures and how Procs and Lambdas capture context

MINI-PROJECTS

Completing a course alone isn't enough to master advanced Ruby concepts.

You need to apply your knowledge to a structured codebase, giving you real-world experience in how professional Ruby projects are organized.

That's why we've added two exciting mini-projects to complement our Advanced Ruby course:

1. MyRake

In this project, you'll apply Ruby concepts by creating a command-line tool that mimics the basic functionality of Rake, a task automation tool.

It's important to complete this mini-project after the Advanced Ruby course to reinforce your knowledge and learn how to structure a Ruby codebase similar to a production-ready gem.

By the end of this project, you will have a solid understanding of how to create a simple task automation tool, similar to Rake, using Ruby.

2. MyInteractor

In this project, you'll apply Ruby concepts by creating a basic version of the popular interactor gem.

This is an excellent way to practice Advanced Ruby skills and learn how to structure a Ruby codebase similar to a production-ready gem.

By the end of this project, you will be proficient in creating an interactor pattern for handling business logic in Ruby applications.

You will learn to manage context using OpenStruct, handle custom errors, and implement argument forwarding.

This project will also enhance your skills in structuring a Ruby codebase and creating modular, reusable code.


Get the Advanced Ruby course

RubyCademy ©