Ruby: 20 Day Gem Challenge Part 1

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.

Gem 1: ox

The first gem is Ox available at https://github.com/ohler55/ox and is a very fast and optimised XML parser and Object marshaller. It’s a native gem and it installs easily (even on Windows) and has no dependencies to get it running.

I chose ox because I do use it often for XML parsing and was multiple times faster than using REXML and I also found it much easier than using Nokogiri which is really a bit complicated.

Gem 2: rcairo

RCairo is the Ruby bindings to the Cairographics library for 2D vector graphics. It is available at https://github.com/rcairo/rcairo

I chose RCairo because many years back, for a project, we used RCairo to do a quick prototype of stitching map tiles and drawing convex hull polygons on the stitched images. I had experience with using Cairographics in C and it was fun to do this quick prototype in Ruby.

If you’re keen to try RCairo, this site has a few relevant pages:

Gem 3: Down

Down is a dead-simple gem for grabbing a file over HTTP/ HTTPS and saving it to a file. It’s fantastically useful especially for downloading images or files.

I chose this because we have some data pipelines that need to get data from services and forward them on to other processing steps via files. You can find it at https://github.com/janko/down/

Gem 4: Blazer

Blazer is fantastic for quickly adding a metric or dashboard to your Rails application. I use it quite a lot for quickly showing relevant data and graphs organised into simple dashboards. It’s great for internal displays and for minimum viable external dashboards.

More details are available at https://github.com/ankane/blazer

Gem 5: Warbler

Warbler is a very useful part of the JRuby ecosystem and helps you make a Java jar or war file out of any Ruby, Rails or Rack application. It provides a minimal, flexible, Ruby-like way to bundle up all of your application files for deployment to a Java environment.

This is a great way to deliver a customised Ruby installation (JRuby + gemsets + your code) as a simple package that can be run anywhere you have Java available. It is available at https://github.com/jruby/warbler. I have used this every now and then and have written up the process of creating your own JARs in case you are keen.

That’s all for Part 1. 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.