#​571 — September 23, 2021

Read on the Web

Ruby Weekly

Using Ruby for Ebook Publishing — The author of Deployment from Scratch enumerates how he uses Ruby in the publishing process, including PDF (and PDF preview) generation, text manipulation, image preview, and more. I'm always a fan of using Ruby as glue in non-Web scenarios like this!

Josef Strzibny

TenderJIT: A JIT for Ruby, Written in Ruby — An interesting project being worked on by esteemed Ruby and Rails core team member Aaron ‘tenderlove’ Patterson. If this sort of thing interests you, he’s running a live session on September 30 which digs into how JITs work and how to implement one, and you can register here.

Aaron Patterson

Building a Reliable Webhook Delivery System Sucks — Skip the grunt work and let Hook Relay manage all your webhooks for you. Inbound and Outbound? ✅ Automated retries plus delivery history for your users? ✅ Visualize Stripe-quality webhooks for your app, now click here to make it a reality in minutes.

Hook Relay sponsor

Building a Real-Time Chat App in Rails with ActionCable and Turbo — A walkthrough creating users, chat rooms, and private chats using the shiniest, new tools in Rails.

Abiodun Olowode (Honeybadger Development Blog)

JRuby Released — The popular JVM-based (Java 8-17 supported, as well as OpenJDK) Ruby implementation gets a new release which is now updated to be compatible with Ruby 2.6.8 standards (in comparison, JRuby 9.2.x was/is Ruby 2.5 compatible).

JRuby Core Team

📕  Preorder for 'Ruby GC in Under Two Hours' Book — Jemma Issroff (of Tip of the week fame, amongst other things) has been writing a book on the Ruby garbage collector that is focused on loading you up with info in as short a time as possible. Mark this down and sweep it up?

Jemma Issroff


Senior Software Engineer (Remote in the US) — Snapdocs is now a Unicorn with a $1.5B+ valuation. We’re a SaaS product disrupting the mortgage and real-estate industry. Join our growing distributed team. ROR, Go, Postgres, React, TypeScript, AWS.

Senior Ruby Engineers | Remote US/EMEA | Full-Time — Orbit is building mission control for communities like Kubernetes and CircleCI. Join our remote team that values empathy and the occasional space pun.

Find Ruby Jobs Through Hired — Create a profile on Hired to connect with hiring managers at growing startups and Fortune 500 companies. It's free for job-seekers.

📕 Articles & Tutorials

How to Reduce Memory Bloat in Ruby — A handful of tips, but with more of an introduction to some of what’s going on behind the scenes in Ruby regarding memory management.

Kumar Harsh

'Move Over Rake, Thor is the New King' — Rake is the longest running and most popular task runner in the Ruby space but Thor presents a compelling alternative (and is reasonably long running itself).

Ben Simpson

Free Index Advisor for Postgres: Get Ideal Index Recommendations — Paste your query and schema data and the pganalyze Index Advisor recommends the ideal index that covers a specific query.

pganalyze sponsor

Let's Read Eloquent Ruby, Chapter 4 — The latest chapter in Brandon’s walk through Russ Olsen’s Eloquent Ruby covers some string methods.

Brandon Weaver

Buffered IO Streams in Ruby — Ruby IO may not immediately write where you are asking it to. This post looks at where data written to a stream goes and when it may or may not be committed where you would expect it to.

Kevin Murphy

Use compact_blank to Remove Empty Strings from Arrays and Hashes — A nicety in Active Support and an alternative to something like .reject { |e| e.nil? || e&.empty? }

Andy Croll

Quick Tip: Going Cookie-Free with Rails — Respect your users’ privacy with this quick lambda.

Ryan Baumann

Rails 7 Adds weekday_select and weekday_options_for_select — More useful new helpers for a common situation.

Deepark Mahakale

Mapping Rails to Hanami — A side-by-side look at the various abstractions of each framework, and while this definitely is Hanami-colored, the mapping is quite informative.

Hanami Mastery

Teaching by Filling in Knowledge Gaps — A good idea and something that used to really keep the blog ecosystem going at one point.

Julia Evans

🛠 Code & Tools

Power Tools for Analyzing Your Heroku Logs — The biggest tool here is Angle Grinder, a real-time log analysis tool that makes parsing, extracting, and aggregating bits out of your logs simple.

Rails Autoscale

Taylor: An Open-Source Game Engine with Ruby Scripting — Taylor is implemented in C++, but the scripting language is mRuby.

Sean Earle

ActiveEventStore: Rails Event Store in a More Rails Way — If you’ve used Rails Event Store, you know it’s great but pretty advanced. This is an effort to make using RES more like the other Active* frameworks.

Vladimir Dementyev

Seamlessly Integrate Video into Your Ruby App

Mux sponsor

RSpec Tracer: A Specs Dependency Analysis Tool — Maintains a list of files used for each test which enables skipping tests in subsequent runs if none of those files change.

Abhimanyu Singh

ffi-libc: Useful Ruby FFI Bindings for libc — Bindings to the libc library which allow accessing certain low-level C functions that Ruby does not (e.g. alarm(2) and getifaddrs(3)).


Ruby Packer: Pack a Ruby App into a Single Executable
Minqi Pan

Rambulance 2.0: Dynamically Render Error Pages or JSON Responses for Rails Apps
Yuki Nishijima

💡 Tip of the Week

General Delimited Input

We sometimes see Ruby snippets like %w(some strings) or %s(some other strings) or %Q(even more #{strings}). It can be a little unclear what is happening. What's the % syntax? What do the different letters do? When are they uppercase or lowercase?

This is usually referred to as 'general delimited input', although I've also heard this called 'percent syntax'. Either way, it's a shorthand for creating strings, arrays, symbols, or regular expressions. And, as we'll see below, each different letter creates an object of a different class.

With one exception, lowercase delimiters ignore interpolation, while uppercase delimiters compute interpolated values.

General delimited input is used most frequently for constants which are arrays of Strings, in codebases which prefer the syntax for multi-line strings, and for regexes.

Let's take a brief tour of a handful of general delimited input syntaxes, and what they do:

%w() or %W() - Arrays of Strings

These split the arguments on space, and create arrays where each element in the array is a String

  • %w() no interpolation, so will split 'interpolated-looking' values on spaces too:
%w(some values #{1 + 1})
=> ["some", "values", "\#{1", "+", "1}"]
  • %W() with interpolation:
%W(some values #{1 + 1})
=> ["some", "values", "2"]

%i() or %I() - Arrays of Symbols

Same as above, except instead of strings, each element is a Symbol.

  • %i() no interpolation, so will split interpolated values on spaces too:
%i(some values #{1 + 1})
=> [:some, :values, :"\#{1", :+, :"1}"]
  • %I() with interpolation:
%I(some values #{1 + 1})
=> [:some, :values, :"2"]

%q() or %Q() - Strings

These will turn the argument into a string.

  • %q() no interpolation, so will split interpolated values on spaces too:
%q(some values #{1 + 1})
=> "some values \#{1 + 1}"
  • %Q() with interpolation:
%Q(some values #{1 + 1})
=> "some values 2"

%s() - Symbols

%s() no interpolation, so will split interpolated values on spaces too:

%s(some values #{1 + 1})
=> :"some values \#{1 + 1}"

%r() - Regex

%r() is the only exception to the capitalization / interpolation rule. %r() will give us a regex with interpolation:

%r(some values #{1 + 1})
=> /some values 2/

Hopefully next time you see, or need to use general delimited input, you now know the appropriate delimiter to use.

Note: The characters delimiting the contents (( and ) in the examples above) don't have to be parentheses, but could be square brackets, braces, angle brackets, and others - but that's a tip for another day.

This week’s tip was written by Jemma Issroff.