New to Ruby? We recommend Ruby in Twenty Minutes to get up to speed.

Local development

To run the code for your challenge locally, you’ll need ruby installed. Our test runners use version 3.3 (as of May 2024).

The script for your challenge (like ./spawn_redis_server.sh) will run your code using Bundler, a dependency manager which comes preinstalled with Ruby. It looks something like this:

#!/bin/sh

exec bundle exec ruby app/main.rb "$@"

File structure

  • The files for your solution are placed in the app/ directory.
  • app/main.rb is the entrypoint of the project.

Adding more files

You can add more files and directories to app/. The test runner will include them when compiling your code.

For example, if you added a file at app/foo.rb, you could use it like so:

Adding dependencies

Gemfile lists your project’s dependencies. You can add dependencies by specifying the name of the gem and optionally the version.

For example, To add the nokogiri gem, add the following line to your Gemfile:

gem 'nokogiri'

Then run the following command to install it:

bundle install

This command will also update your Gemfile.lock file.