Ruby: 20 Day Gem Challenge Part 4

Recently on Bluesky, there was a #20DayGemChallenge where we were encouraged to choose 20 Ruby gems that we’ve used time and time again, or have inspired us in some way and post one gem per day in no particular order and with no explanation. This series of posts explains my specific reason for choosing each of these gems.

As a general guide, I tried to pick slightly unique gems in the hope that it would help others discover something different rather than the obvious ones that are always being discussed. Also, I wanted to pick gems that had some significance to my use of Ruby (or Rails) over the past many years.

So, let’s get started. Each post has 5 gems.

This list is really the home stretch in the sense that I come across all of these gems often, or have done over the past many years.

Gem 16: rspec

I am someone who prefers rspec and have used it for all sorts of testing. I started by using it first for testing some APIs and then ended up generating a long Word document (using Textile that was converted to HTML and imported into Word), command files and curl commands for hitting the API with the test data. RSpec is at https://github.com/rspec

Gem 17: ruby-oci8

We don’t hear much about Oracle databases in the Ruby world, but ruby-oci8 is the Ruby interface for Oracle databases. You can use it to connect Rails to Oracle databases, or even access Oracle databases from Sequel. If you are keen, I wrote up a quick start for Windows users using OCI and Sequel. You can find the source on GitHub at https://github.com/kubo/ruby-oci8

Gem 18: erb

ERB is a simple but powerful templating system for Ruby – it is a great asset in the toolkit for automation. Many people recognise it from Rails but it’s a great tool for generating files using substitution and templates. I’ve used it for creating sub-projects for Embarcadero C++ Builder (the sub-projects were plugins for one of our systems), email bodies with content plugged in from analysing information, and even for supporting environment variable substitution for smarter configuration files. You can find it on GitHub at https://github.com/ruby/erb/tree/master

Gem 19: sqlite3-ruby

Outside of Rails, my most common use for Ruby was in data processing and database management. For this, SQLite3 was a common target especially from smaller scripts and applications. As a result, sqlite3-ruby (see: https://github.com/sparklemotion/sqlite3-ruby) is a main stay in my toolbelt.

Gem 20: rails

The last gem in this series is Ruby on Rails – without a doubt, that was the gateway drug that made me discover Ruby almost 18 years back. A lot has happened in the Rails world in 2024 and Rails 8 seems set to empower new developers to build bigger and more ambitious things. Of course, you know where to find it: https://github.com/rails/rails/rails

That’s all for this year! If you have any other thoughts or questions, feel free to comment below, or connect with onghu@x or @onghu@ruby.social on Mastodon or @onghu.com on Bluesky to discuss more.