Require Ruby Gems

Amjad Masad

On the heels of our Node.js npm support announcement, we're pleased to announce that we now support Ruby Gems too. We're excited to have the Ruby community join the fun.

The way it works is slightly different from our Node or Python implementations. In Node or Python you simple require/import the module you'd like to use, and we'll automagically install the package for you. In Ruby, unfortunately, we couldn't find a reliable way to map requires to Gems so we had to go with a neat feature of Bundler: bundler/inline where you can define your gemspec in the code. This works well for Repl.it because we'd like to make it easy for people to use the repl without having to add files.

Here is an example, this uses the gem colorlize to print an ascii drawing of the American flag:

We're still working on improving this, look forward to the following the coming days:

  • Per repl caching: install once, there forever
  • Gemfile support

Feedback welcome!

More blog posts