We've added multiple exciting mini-projects to complement our Ruby for Beginners and Advanced Ruby courses. These projects will give you practical experience in building structured, maintainable codebases for real-world applications.

1. MyRake

This project will help you 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.

Tools and Concepts We'll Use

  • Hash
  • Global variable and class methods
  • Blocks and Procs: Understanding blocks and how they can be saved as Procs for later execution.
  • ARGV: Array of arguments passed to the script from the command line.
  • require_relative: Used to load files relative to the file containing the call.
  • Module Mixins: Mixing in modules to add functionality to classes.
  • The main Object: Understanding how methods included in the main object become available globally.
  • Argument Forwarding Operator: Introduced in Ruby 2.7, it forwards arguments from one method to another.

Project Structure

my_rake/
├── lib/
│   ├── my_rake/
│   │   ├── task.rb
│   │   └── dsl.rb
│   └── my_rake.rb
├── Rakefile
├── bin/
│   └── my_rake.rb

2. FileEncryption

This project will help you apply Ruby concepts by creating a command-line tool to encrypt and decrypt files using simple algorithms like Caesar Cipher.

It's important to complete this mini-project after the Ruby for Beginners course to reinforce your knowledge.

The codebase is structured as a production-ready gem, which gives you a taste of how professional Ruby projects are organized.

Tools and Concepts We'll Use

  • Modules as Namespace: To avoid name clashes and organize code.
  • Modules as Helpers: To provide utility functions.
  • Caesar Cipher Algorithm: A basic encryption technique where each letter in the plaintext is shifted a certain number of places down or up the alphabet.
  • File and Dir Class and Modules: Provided by Ruby to handle file and directory operations. These classes are part of Ruby’s core library, maintained by the Ruby core team. The File class is used for file manipulation, while the Dir class is used for directory operations. We will use them to read, write, and manipulate files.

Project Structure

file_encryption/
├── lib/
│   ├── file_encryption/
│   │   ├── encrypter.rb
│   │   ├── decrypter.rb
│   │   └── utilities.rb
│   └── file_encryption.rb
├── bin/
│   └── encrypt.rb
│   └── decrypt.rb
├── test_directory/
│   ├── sample.txt

3. FileOrganizer

In this project, we'll create a script to organize files in a directory by their extensions.

For example, .jpg files go into an Images folder, .txt files go into a Documents folder, etc.

By the end of this project, you will have a deeper understanding of Ruby file operations, directory management, and practical usage of classes and modules to organize code effectively.

It's important to complete this mini-project after the Ruby for Beginners course to reinforce your knowledge

The codebase is structured as a production-ready gem, which gives you a taste of how professional Ruby projects are organized.

Tools and Concepts We'll Use

In this project, we will be using the following tools and concepts:

  • File and Dir Class and Modules: Provided by Ruby to handle file and directory operations. These classes are part of Ruby’s core library, maintained by the Ruby core team. We will use them to list files, check existence, create directories, and move files.
  • FileUtils Module: This module provides methods for file manipulation such as copying, moving, and deleting files.
  • Basic Data Types: Learn how to utilize Hash, Array, and String to represent the different layers of data needed for the mini project.
  • Modules as Namespace: To avoid name clashes and organize code.
  • Modules as Helpers: To provide utility functions.
  • Argument Forwarding Operator: Introduced in Ruby 2.7, it forwards arguments from one method to another.

Project Structure

file_organizer/
├── lib/
│   ├── file_organizer/
│   │   ├── organizer.rb
│   │   ├── file_categorizer.rb
│   │   ├── file_mover.rb
│   │   └── utilities.rb
│   └── file_organizer.rb
├── bin/
│   └── organize.rb
├── test_directory/
│   ├── image.jpg
│   ├── document.txt
│   ├── video.mp4
│   ├── music.mp3
│   └── archive.zip

4. MyInteractor

This project will help you 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.

Tools and Concepts We'll Use

  • Argument Forwarding Operator: Introduced in Ruby 2.7, it forwards arguments from one method to another.
  • Error Handling: Custom error classes and raising exceptions.
  • OpenStruct: Flexible object that can have its attributes added at runtime.
  • self.included Hook Method: Adds behavior to a module or class when it is included in another module or class.
  • require_relative: Loads files relative to the file containing the call.
  • End-less Methods: A shorthand syntax for method definitions introduced in Ruby 3.0.

Project Structure

my_interactor/
├── lib/
│   ├── my_interactor/
│   │   ├── context.rb
│   │   └── failure.rb
│   └── my_interactor.rb
├── bin/
│   └── create_user.rb

5. HTML Generator - Part 2

Description

Let's get rid of the HTML explicit receiver to enhance our DSL

In this mini project, we'll improve our HTML Generator DSL by removing the explicit HTML receiver, making our code more elegant and readable. You'll learn advanced Ruby techniques for creating intuitive domain-specific languages.

Skills you'll practice

  • Domain-Specific Language (DSL) design
  • Method missing and dynamic method handling
  • Ruby metaprogramming techniques
  • Clean code principles

6. Recode `attr*` macros

Description

A fun way to learn more about metaprogramming and Ruby internals

In this mini project, you'll recreate Ruby's attr_reader, attr_writer, and attr_accessor macros from scratch. This hands-on exercise will deepen your understanding of Ruby's metaprogramming capabilities and how the language works under the hood.

Skills you'll practice

  • Ruby metaprogramming
  • Class and instance variable manipulation
  • Method definition at runtime
  • Understanding Ruby's object model

7. MyRSpec

Description

Let's recode a robust version of RSpec

In this challenging mini project, you'll build a simplified version of the popular RSpec testing framework. You'll implement core features like describe, context, it, and expectations, gaining deep insights into how testing frameworks work.

Skills you'll practice

  • DSL design for testing
  • Block handling and execution contexts
  • Test runner implementation
  • Expectation and matcher patterns

8. MyActiveRecord

Description

Let's recode a robust version of ActiveRecord::Base and ActiveRecord::Relation

In this advanced mini project, you'll implement a simplified version of Rails' ActiveRecord ORM. You'll create the core functionality for database connections, model definitions, and query building, gaining valuable insights into how ORMs work.

Skills you'll practice

  • ORM design patterns
  • SQL query generation
  • Chainable query interfaces
  • Database connection management


FLASH SALE Subscribe to RubyCademy: all courses included ($358 value).

JOIN NOW

RubyCademy ©