百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

ruby-exercises

> 编程语言
开源

The Odin Project Ruby 练习 关于此仓库 此仓库是对 The Odin Project 的 Ruby 课程的补充。它包含 ...

313 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

The Odin Project Ruby 练习 关于此仓库 此仓库是对 The Odin Project 的 Ruby 课程的补充。它包含 ...

The Odin Project Ruby Exercises

About this repository

This repository is a complement to the Ruby course for The Odin Project. It contains a series of Ruby exercises alongside pre-written tests that will help guide the student towards a solution, providing a Test Driven Development experience.

Each set of exercises should only be done after being directed to do so in the assignment of the corresponding Ruby lesson. I.e. if you just finished the Basic Data Types lesson you should only do the exercises in the 1_data_types folder for now.

[!IMPORTANT] Please do not submit your solutions as a PR to this repository. Any PR that does this will have to be closed.

Forking, cloning and installation

Fork this repository by clicking on the "Fork" button in the top right, above the repository's "About" section.

Clone your fork to your local machine. To do this, make sure you are in the forked repository on GitHub then click on the green "Code" button at the top right of list of files and copy the link in the prompt. Then, run the following command in your terminal:

bash
git clone 

This will create a folder called 'ruby-exercises' inside the directory you ran the command in.

CD into that folder:

bash
cd ruby-exercises

Now before beginning work on the exercises, you'll want to install a gem called RSpec. RSpec is a popular Ruby testing framework that is used in this repository to provide you with tests that check your solutions.

To install RSpec, run the following command in your terminal:

gem install rspec

You should see a message that says something along the lines of "6 gems installed" in your terminal. Verify that the installation was successful by simply running the following command:

rspec

Which should print a few lines about not finding any examples. This is ok and means it's working!

If your shell reports that it cannot find the rspec binary, it may be necessary to run the following command:

rbenv rehash

Usage

Each directory contains a read me with instructions for the exercises within them.

Contributing

Make sure that when changing an exercise or its tests that you also make the required changes to that exercise's solution under the solutions/ directory.

If you're writing an entirely new exercise, there's a script provided to help generate the correct directory structure and boilerplate. An example use for if you wanted to create a new exercise in ruby_basics for working with Ruby blocks:

bash
bin/generate_exercise ruby_basics 13_blocks block_exercises

This will setup the following structure automatically:

bash
.
├── ruby_basics
│   └── 13_blocks
│       ├── exercises
│       │   └── block_exercises.rb
│       └── spec
│           ├── block_exercises_spec.rb
│           └── spec_helper.rb
└── solutions
    └── ruby_basics
        └── 13_blocks
            ├── exercises
            └── spec
                └── spec_helper.rb

Issues· 11 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubyruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言