#​557 — June 17, 2021

Read on the Web

Ruby Weekly

"GitHub Processes 2.8 Billion API Requests Per Day".. with Ruby — It’s only a quick tweet, but when GitHub’s CEO says the company is handling 2.8 billion API requests per day (55k rps at peak) and a GitHub engineer notes that it’s on Rails.. that’s a nice data point for us Rubyists, I reckon :-)

Nat Friedman (GitHub)

ActiveAnalytics: First-Party, Privacy-Focused Traffic Analytics for Rails Apps — Analytics is good, privacy is good. Have all the good things with this gem that’ll tell you referrers, page views, and the next/previous page paths.

Base Secrète

The Ultimate Button Component — Learn how we developed The Ultimate Button to use in our internal tools. It's a ViewComponent button you can use anywhere in your app. It uses StimulusJS & is highly configurable. 4-week free trial + $100 free credits with the code: Ruby-Weekly!

Cloud 66 sponsor

A Rubyist's Walk Along the C-Side: Primitive Data Types — The latest part in a (fantastic) series on Ruby’s C API. Peter hones in on a few of the primitives, namely String, Array, Fixnum, Hash, Symbol, and some other constants.

Peter Zhu

▶  Discussing Speedy Performance with Nate Berkopec — Nate Berkopec is the author of the Complete Guide to Rails Performance, the maintainer of Puma, and one of a small group of people you could consider Ruby performance experts. On this show, he mostly talks about how he got to that position and his opinions on things like profiling and server-side rendering.

The Bike Shed Podcast podcast

  • It's not the latest branch but Rails 6.0.4 has been released with bug fixes across all of the major libraries.

  • Vagrant is a popular tool for setting up development environments in VMs that originally launched as a Ruby powered tool for automating VirtualBox. But in news this week Vagrant is being rewritten in Go, but in a way that will maintain some Ruby-based features.

  • JRuby has been released - it's still the Ruby 2.5 compatible branch for now, but is still in the pipeline.

  • RubyGems 3.2.20 has been released, mostly to fix a remote code execution bug. The May 2021 RubyGems Updates post has also gone up with more updates about the gems ecosystem.

  • AnyCable has branched out and is now offering a 'pro'-level version.


Senior Software Engineer | ML & Data Team (Elasticsearch, Ruby) (Remote) — Help us build our internal search system and join a globally distributed team that truly cares about delivering remarkable learning experiences.

Senior Rails Engineer Position Open at OmbuLabs and FastRuby.io — We are looking for engineers who love working on maintenance projects and upgrades. Be a part of our close-knit team.
OmbuLabs and FastRuby.io

Find Ruby Jobs with Hired — Take 5 minutes to build your free profile & start getting interviews for your next job. Companies on Hired are actively hiring right now.

📕 Tutorials

▶  How to Create Custom Elements with Web Components — Web Components provide a way to encapsulate JavaScript logic around an element in your HTML. This 15 minute screencast looks at their use as well as how Hotwire uses them for Turbo Stream actions.


Adding TypeScript to Your Existing Rails App — The thought of porting all the existing JavaScript you have might seem a little intimidating, but it’s possible to introduce TypeScript more gradually..

Ayooluwa Isaiah

How to Build Scalable Ruby Apps with CockroachDB & Ruby PG Driver — If you follow this seven step tutorial you’ll end up building a scalable, resilient Ruby Application - For Free.

Cockroach Labs sponsor

Building Large Features: A Process for Branches, Requests and Reviews — One developer’s refinement of a process for managing the implementation of large features on git-based projects.

Rémi Mercier

Building Your Own Rails Form Builders — Rails form builders are great…until they’re not. That’s why gems like Simple Form exist, but what if that isn’t right for your use case? Well, making your own form builder is easier than you probably think.

Brand New Box

Moving ActionCable Over to Webpacker
Josef Strzibny

Getting Started with Automated Testing Workflow and CI on Ruby
Axel Kee

🎧 Podcasts

▶  Decoding Ruby's Magical Syntax with Justin Gordon — Justin and Jason discuss Ruby syntax, reducing the need for testing with Rescript or Rust, the benefits of time tracking, and the skills needed for running a successful agency.

Rails with Jason

▶  Dave Thomas on Testing Past, Present, and Future — As with most things involving Dave, the takeaways are great. A sample: Treat testing as a tool, not a religion. CS undergrads need more real-world experience.


🛠 Code and Tools

Countries 4.0: Useful Info about Countries Packaged into a Gem — Need country info in an easily used form from Ruby? This gem contains info for each country covering standards ISO3166-1 (countries), ISO3166-2 (states/subdivisions), ISO4217 (currency) and E.164 (phone numbers).


⚽️  Seven Days of Football/Soccer Related Ruby Gems — An unusual topic, you might think, but timely too as UEFA EURO 2020 (a poorly named European soccer tournament) has just kicked off.

Gerald Bauer

Uptime Monitoring Is Now Available in AppSignal

AppSignal sponsor

Committee 4.4: Rack Middleware to Build Services with JSON Schema — For when you want to build services based upon JSON Schema, OpenAPI 2, or OpenAPI 3.


Shrine 3.4: The File Attachment Toolkit for Ruby Webapps — The latest update to a powerful plugin-driven file attachment system. Validations, background jobs, cloud storage integrations, and more await. GitHub repo.


Textbringer 1.1: An Emacs-Like Text Editor Written in Ruby — Projects like this often fizzle out, but we first linked this 4 years ago in issue 344 and it’s great to see it go from strength to strength.

Shugo Maeda

💡 Tip of the Week

Heredoc Indentations

There are a few different ways to start heredocs <<, <<- and <<~. After that, every heredoc has an identifier/delimiter (typically in uppercase and relevant to the purpose of the heredoc, like SQL), the multiline string, and then the same identifier at the end. I've seen the three starts (<<, <<- and <<~) used interchangeably in some codebases, yet there is a critical difference between them: each treats indentation differently.

For <<, the ending identifier cannot be indented, and any indentations in the text will be treated as whitespace:

    ugly_indented_code = <<NO_DASH
      This doesn't read well for indented code
      because it means that the end idenfier 
      will be all the way to the left

The next start, <<-, allows us to indent the end identifier, but will also preserve all whitespace:

    too_much_whitespace = <<-STRAIGHT_DASH
      The straight dash will also track indented strings
        with a whole lot of whitespace

=> " The straight dash will also track indented strings\n with a whole lot of whitespace\n"

Lastly, using the tilde or 'squiggly dash' <<~ allows us to indent the end identifier, and also de-indents the content of the whole string to align with the least indented part of the string:

    less_whitespace = <<~SQUIGGLY_DASH
      Squiggly dash allows for indented end identifier
        And indents the content of the whole string
          To align with the least indented part of the string

=> "Squiggly dash allows for indented end identifier\n And indents the content of the whole string\n To align with the least indented part of the string\n"

This last option is the most popular because it allows the end identifier to be intented, and has the least whitespace preserved within the String itself.

This week’s tip was written by Jemma Issroff.