---
title: "Stripe shows off its Ruby compiler"
publication: "Ruby Weekly"
issue: 564
published_at: "2021-08-05"
canonical_url: "https://rubyweekly.com/issues/564"
---

Plus an exciting new Nokogiri release, Matz talks Crystal, and the Fukuoka competition is back again. |        

#​564 — August 5, 2021 

[Read on the Web](https://rubyweekly.com/issues/564)    

Ruby Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/pdjwwc0x9za5c5lljbkg.jpg)](https://sorbet.org/blog/2021/07/30/open-sourcing-sorbet-compiler)  

[Sorbet Compiler: Stripe's Experimental, Ahead-of-Time Compiler for Ruby](https://sorbet.org/blog/2021/07/30/open-sourcing-sorbet-compiler) — Stripe has been experimenting with an AOT compiler for Sorbet for about a year, and is now open-sourcing it for all to see. It’s not ready for production (outside of Stripe) yet, but the concept is solid, and the potential is exciting. 

Sorbet   

[A Sneak Peek at Ruby's New Debugger](https://dev.to/st0012/a-sneak-peek-of-ruby-s-new-debugger-5caa) — Ruby 3.1 will ship with a new debugger (clearly inspired by both GDB and byebug) that has some great features like scripting debug commands within your code so you don’t, for example, have to dig through gems to set breakpoints. 

Stan Lo   [![\](https://copm.s3.amazonaws.com/47294813.png)](https://ter.li/a2lzp4) 

[Try Scout’s New Error Monitoring Feature Add-On for Free](https://ter.li/a2lzp4) — Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues in minutes. See for yourself why Scout is a Ruby developers’s best friend with a free 14-day trial, no credit card needed. 

Scout APM sponsor   

[The 2022 Fukuoka Ruby Award Competition](https://www.ruby-lang.org/en/news/2021/08/03/fukuoka-ruby-award-2022/) — Every year the government of Fukuoka (a _prefecture_ of Japan) teams up with Matz (the creator of Ruby) to offer a 1 million yen prize to the developer(s) of an ‘interesting Ruby program’ developed in the past year. So if you like competitions _and_ think you can impress Matz, enter by December 3rd. 

Fukuoka Ruby   

▶[Matz's Talk at a Crystal Conference](https://www.youtube.com/watch?v=KbFHbkY27no) — We’ve mentioned [Crystal](https://crystal-lang.org/), a Ruby-inspired compiled and statically typed language, a few times recently, and even Ruby’s creator gave a talk to the Crystal community where he showed support for their endeavors and said he ‘encourages the search’ for better solutions. 

Yukihiro 'Matz' Matsumoto   

[Ruby Support Added to _Compiler Explorer_](https://godbolt.org/z/3jdM7hz3h) — If you’re not familiar with [Compiler Explorer](https://godbolt.org/) it’s a really neat tool for compiling code and letting you walk through the output (I’ve spent many an hour analyzing GCC optimizations with it with simple C code - _yes, I’m a nerd_) and it now shows you the VM code for Ruby code of your choice. I’d struggle to explain why this is neat, so.. have a play. 

Matt Godbolt     

Jobs  

[Senior Ruby on Rails Engineer (Remote)](https://apply.workable.com/nebulab/j/23D8DA2134/) — Join our distributed team and build high-volume eCommerce applications in a workplace made by developers for developers. 
Nebulab   

[Senior Rails Team Seek New Members](https://angel.co/company/startuplandia/jobs/1482768-fullstack-rails-developer) — We’re seeking two experienced Rails devs to join our team. Cool tech, strong remote culture, solid FinTech product. ✌️ 
startuplandia.io   

[Find Ruby Jobs Through Hired](https://hired.com/join/?utm_source=newsletter&utm_medium=sponsor&utm_campaign=%28b2c%29%28l-all%29%28r-all%29%28cooper-rubyweekly%29&utm_content=find-your-next-job) — Create a profile on Hired to connect with hiring managers at growing startups and Fortune 500 companies. It's free for job-seekers. 
Hired    

📕 Articles & Tutorials  

[An Introduction to Pattern Matching in Ruby](https://blog.appsignal.com/2021/07/28/introduction-to-pattern-matching-in-ruby.html) — Pattern matching is a new, experimental feature in Ruby 2.7 (certain features are stable in 3.0) inspired by Elixir. It seems foreign at first, but the utility soon becomes very apparent. 

Pulkit Goyal   

[Running Rails on the Google Cloud Run Environment](https://cloud.google.com/ruby/rails/run) — _Cloud Run_ is Google’s service for running containerized apps in a serverless fashion. 

Google Cloud   

▶[Information Foraging: Tricks Great Developers Use to Find Solutions](https://stackoverflow.blog/2021/06/15/podcast-347-information-foraging-the-tactics-great-developers-use-to-find-solutions/) — Professor Austin Henley explains the tactics veteran developers use to quickly find the best solutions. 

Stack Overflow Podcast sponsorpodcast   

[Esoteric Ruby in MemoWise](https://jemma.dev/blog/esoteric-ruby-in-memowise) — Frequent _Tip of the Week_ contributor Jemma Issroff pens another post on the internals of MemoWise (a memoization gem) including how to memoize frozen objects and other oddities. 

Jemma Issroff   

[Using ActiveRecord's `#update_counters` to Prevent Race Conditions](https://www.honeybadger.io/blog/activerecord-update-counters-race-conditions/) — `update_counter` provides a convenient way to avoid race conditions when incrementing or decrementing values in the database. 

Jonathan Miles   

[Deprecating Code in a Rails Application](https://everydayrails.com/2021/07/31/rails-custom-deprecation-warnings.html) — Did you know `ActiveSupport::Deprecation` makes it pretty easy to add deprecation warnings to your own code? If plentiful deprecations are good enough for Rails, they're good enough for you ;-) 

Aaron Sumner   

[Free eBook: Effective Indexing in Postgres](https://pganalyze.com/ebooks/postgres-indexing?utm_source=RubyWeeklySecondary08052021) 

pganalyze sponsor   

▶[Dynamic Select Fields in Rails with Hotwire](https://gorails.com/episodes/dynamic-select-fields-with-rails-hotwire) — Want to dynamically update fields when a user changes a select box? Hotwire’s Turbo Stream actions to the rescue. 

Go Rails   

[`ActiveRecord::Calculations` Will Now Use Column-based Type Casting](https://blog.saeloun.com/2021/08/04/active-record-calculations-column-based-type-casting.html) 
Swaathi Kakarla   

[Understanding Ruby: `for` vs `each`](https://dev.to/baweaver/understanding-ruby-for-vs-each-47ae) 
Brandon Weaver  

🛠 Code & Tools 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/xbmvbvghm3nnahmc3jaa.jpg)](https://github.com/sparklemotion/nokogiri/releases/tag/v1.12.0)  

[Nokogiri 1.12.0 Released with New HTML5 Support](https://github.com/sparklemotion/nokogiri/releases/tag/v1.12.0) — HTML5 support has been added (to the CRuby variant only) by merging [Nokogumbo](https://github.com/rubys/nokogumbo) into [Nokogiri](https://nokogiri.org/), a still popular way to work with XML and HTML from Ruby. _P.S. Did you know a 'nokogiri' is a type of Japanese saw? Hence the picture above._ 

Sparkle Motion   

[Six Command Line Tools for Productive Programmers](https://earthly.dev/blog/command-line-tools/) — Some truly helpful items here. The [FZF](https://github.com/junegunn/fzf) fuzzy file finder (written in Go) is particularly handy. 

Adam Gordon Bell   

[MemoWise 1.1: The Modern Choice for Ruby Memoization](https://github.com/panorama-ed/memo_wise) — It’s fast, has good test coverage, full documentation, lets you reset or preset values, and more. 

Panorama Education   

[Babosa: A Library for Creating Slugs](https://github.com/norman/babosa) — An extraction of code from [FriendlyId](https://github.com/norman/friendly_id) for normalizing and sanitizing data for use as a simultaneously computer and human friendly identifier. Apparently _babosa_ is Spanish for slug – it certainly sounds nicer. 

Norman Clarke   

[Puma 5.4 Released: A Rack Web Server Built for Concurrency](https://github.com/puma/puma/releases/tag/v5.4.0) 

Puma Team   

[SearchFlip 3.5.0: Full-Featured Elasticsearch Client with Chainable DSL](https://github.com/mrkamel/search_flip) — If you need Elasticsearch’s powerful brand of full text search in your Ruby apps, this is a worthy option. 

Benjamin Vetter       

💡**Tip of the Week** 

    

## `include` 

In [last week's tip](https://rubyweekly.com/issues/563), we learned about `ancestors`. This set us up to learn about three ways of using code from a module in a class. This week, we'll discuss what is likely the most common of these approaches: [`include`](https://ruby-doc.org/core-3.0.2/Module.html#method-i-include). 

We can look at an example of using `include` to include a module's methods in a class: 

```
module ExampleModule
  def example_method
    "This is defined in the module we're including"
  end
end

class ExampleClass
  include ExampleModule
end

ExampleClass.new.example_method
=> "This is defined in the module we're including"
``` 

What is actually happening when we `include ExampleModule`, or `include` any module or class, is that this module or class will be inserted in the ancestors chain directly after the class which `include`s it: 

```
ExampleClass.ancestors
=> [ExampleClass, ExampleModule, Object, Kernel, BasicObject]
``` 

As we learned last week, this means that Ruby will first look for a method defined on `ExampleClass`, and if it's not defined there, it will continue to traverse the list of ancestors, looking next at `ExampleModule`. 

This means using `include` gives us the helpful property of being able to easily override methods defined in an included module: 

```
module ExampleModule
  def example_method
    "This is defined in the module we're including"
  end
end

class ExampleClass
  include ExampleModule
  
  def example_method
    "This is defined in ExampleClass itself"
  end
end

ExampleClass.new.example_method
=> "This is defined in ExampleClass itself"
``` 

If we're used to using `include`, we might have an intuitive understanding of this overriding in action. Hopefully now with the context around `ancestors`, we can see _why_ it's happening. In the coming weeks, we'll have tips around two other ways of using code from modules or classes: `extend` and `prepend`.    

This week’s tip was written by [Jemma Issroff](https://twitter.com/jemmaissroff).          

Curated by [Peter Cooper](https://twitter.com/peterc), [Glenn Goodrich](https://twitter.com/ruprict) and [Cooperpress](https://cooperpress.com/). 

[Change your email address](https://rubyweekly.com/edit_subscription/*|UID|*) or[Stop getting this newsletter](https://rubyweekly.com/leave/*|UID|*) 

© Cooper Press Ltd · Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom
