---
title: "Let's create a basic (useful) Ruby C extension"
publication: "Ruby Weekly"
issue: 631
published_at: "2022-12-01"
canonical_url: "https://rubyweekly.com/issues/631"
---

Plus Ruby 3.1.3, the Advent of Code, and giving Crystal a try. |        

#​631 — December 1, 2022 

[Read on the Web](https://rubyweekly.com/issues/631) 🇺🇦   

If you missed [last week's issue](https://rubyweekly.com/issues/630), make sure to take a look. It was a _bumper_ week with lots of cool stuff including a major new JRuby release, Hanami 2.0, plus an interview with the _Pickaxe's_ newest author. Now, without further ado, on to this week..
__
_Peter Cooper, your editor_ 

Together with [![ButterCMS\](https://res.cloudinary.com/cpress/image/upload/c_fill,g_auto,e_trim,w_700,h_100/e_make_transparent/co_white,e_outline:10/h4j9v0v4af8ufqqreqfq.png)](https://buttercms.com/ruby-cms/?utm_source=rubyweekly&utm_medium=email&utm_campaign=retirelegacycms)  

Ruby Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60,q_auto/wssbgx0irlwgluuj6rup.jpg)](https://kddnewton.com/2022/11/30/advent-of-yarv-part-0.html)  

[Kevin Newton's _Advent of YARV_](https://kddnewton.com/2022/11/30/advent-of-yarv-part-0.html) — Let’s start with something incredibly advanced and work our way down :-) Kevin works at Shopify and his projects include [SyntaxTree](https://github.com/ruby-syntax-tree/syntax_tree), [Exreg](https://github.com/kddnewton/exreg), and contributing to YJIT. He knows his stuff, so it’s great to see him kick off a month of posts _“detailing different aspects of the CRuby virtual machine.”_ Part 0 covers the terminology and bare basics, with [part 1](https://kddnewton.com/2022/12/01/advent-of-yarv-part-1.html) pushing on to cover the stack. 

Kevin Newton   [![\](https://copm.s3.amazonaws.com/f8c1e433.png)](https://buttercms.com/ruby-cms/?utm_source=rubyweekly&utm_medium=email&utm_campaign=retirelegacycms) 

[🧈 Retire your Legacy CMS with ButterCMS](https://buttercms.com/ruby-cms/?utm_source=rubyweekly&utm_medium=email&utm_campaign=retirelegacycms) — ButterCMS is your new content backend. We’re SaaS so we host, maintain, and scale the CMS. Enable your marketing team to update website + app content without needing you. Try the #1 rated SaaS Headless CMS for Ruby today. Free for 30 days. 

🧈 ButterCMS sponsor   

[Ruby 3.1.3 Released (and 3.0.5 and 2.7.7)](https://www.ruby-lang.org/en/news/2022/11/24/ruby-3-1-3-released/) — Don’t get too excited - these are minor releases principally to cover a security fix for a [`cgi` gem HTTP response splitting vulnerability.](https://www.ruby-lang.org/en/news/2022/11/22/http-response-splitting-in-cgi-cve-2021-33621/) If you need them, here are the [3.0.5](https://www.ruby-lang.org/en/news/2022/11/24/ruby-3-0-5-released/) and [2.7.7](https://www.ruby-lang.org/en/news/2022/11/24/ruby-2-7-7-released/) release posts. 

nagachika / Ruby Core Team   

**QUICK BITS** 

- The nascent _Rails Foundation_ is [seeking an executive director](https://rubyonrails.org/2022/11/30/rails-foundation-executive-director) to run day to day operations and lead efforts around community engagement, documentation, and more. Fully remote, too.
- ▶️ _BridgetownConf_ was an online conference held for the [Bridgetown](https://www.bridgetownrb.com/) Ruby static site generator and [the talks are now online](https://www.bridgetownconf.rocks/) for all to enjoy.
- Shopify, the ecommerce platform well known for its use of Ruby and Rails, [boasts driving 3 terabytes per minute of egress](https://twitter.com/ShopifyEng/status/1597983918900510720) across its platform during the recent shopping season. All hitting a Rails app? No. But Ruby is down in there.. _somewhere_ ;-) I'd love to see their AWS bill.   

🎄 [The Advent of Code 2022: 25 Days of Code Challenges](https://adventofcode.com/) — If you have a little time each day for a programming puzzle, the _Advent of Code_ is back. There’s [a sub-Reddit](https://www.reddit.com/r/adventofcode/) where people discuss their solutions and I’ve had my brain stretched and flexed from looking at other people’s creative approaches. 

The Advent of Code   

Consider [MuumiJumala's solution](https://www.reddit.com/r/adventofcode/comments/z9ezjb/2022_day_1_solutions/iygtai7/) for today's (very easy) puzzle. `$/*=2` is not something I'd ever think to write, but is very apt here!  

[How to Migrate a Rails App from Heroku to Dokku (Updated)](https://pawelurbanek.com/rails-heroku-dokku-migration) — If you want a cheaper hosting solution for your side projects or staging environments, it’s not _too_ tricky to move a Heroku app to your own Dokku instance (especially now that Heroku's free option has gone away) including migrating the database and SSL with _Let’s Encrypt._ 

Paweł Urbanek  

📕 Articles, Videos, and Opinions 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60,q_auto/efvuini3wak9e1mq8ng8.jpg)](https://build.betterup.com/tracking-a-processs-memory-usage-in-ruby/)  

[Tracking a Process's Memory Usage in Ruby](https://build.betterup.com/tracking-a-processs-memory-usage-in-ruby/) — Another title for this post could be _“Create a Basic Yet Useful C Extension in Ruby”,_ so you’ll learn more than just tracking memory usage. A fun bit of poking about. 

Victor Andrey (BetterUp)   

[Hanami 2.0 Thoughts](https://ryanbigg.com/2022/11/hanami-20-thoughts) — Last week we told you about [Hanami’s](https://hanamirb.org/) newest major release, and here’s one Rubyist’s thoughts on it. Spoiler: It’s missing a couple of bits (coming in 2.1) but it’s really fast. 

Ryan Bigg   

[🕵️💎 Rails’ Hidden Gems - ActiveRecord Store](https://www.honeybadger.io/blog/rails-activerecord-store/?utm_source=rubyweekly&utm_medium=email&utm_campaign=ruby) — The latest article in our series spotlighting Rails’ lesser-known gems. Check it out and level-up your Rails game. 

Honeybadger sponsor   

[Dealing with Flaky Tests](https://naildrivin5.com/blog/2022/11/29/dealing-with-flaky-tests.html) — Is it possible to have a significant test suite without having lots of flaky tests? It is, says, David, who shares some tips on how he avoids the problem for himself, including writing tests that are prepared to handle random data. 

David Bryant Copeland   

[Safe Gem Upgrades with Pessimize](https://hanamimastery.com/episodes/34-versioning-with-pessimize) — [Pessimize](https://github.com/joonty/pessimize) is a tool that adds pessimistic constraints (e.g. those using `~>`) to _all_ gems in your Gemfile. This can help you take more control over upgrades of dependencies in future. 

Hanami Mastery   

[From Paperclip to Active Storage at Scale](https://finnian.io/blog/from-paperclip-to-active-storage-at-scale/) — One developer’s experience of migrating from Paperclip to Active Storage on a production site. 

Finnian Anderson   

▶[Kevin Newton Talks About Ruby Parsing](https://topenddevs.com/podcasts/ruby-rogues/episodes/the-new-ruby-parser-with-kevin-newton-ruby-571) — Kevin works on the [Prettier for Ruby](https://github.com/prettier/plugin-ruby) code formatting plugin (plus, y'know, all that stuff in the top most item above). 

Ruby Rogues podcast   

[The State of Notifications Report - User Preferences](https://www.courier.com/download-state-notification-report/?utm_campaign=cooper-press&utm_source=email&utm_medium=ruby-weekly-12-1&utm_content=state-of-notifications) 

Courier.com sponsor   

[Creating Multi-Line Strings in Ruby](https://www.bootrails.com/blog/ruby-multiline-string/) — How do I write strings? _Let me "count" %{the ways}.._ 

David Boureau   

[Handling Third-Party Webhooks with Rails Event Store](https://blog.arkency.com/handling-third-party-webhooks-with-rails-event-store/) 
Piotr Jurewicz  

🛠 Code & Tools 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60,q_auto/xp6rxtkmhhrbh4iginx0.jpg)](https://blog.jetbrains.com/ruby/2022/11/rubymine-2022-3-released/)  

[RubyMine 2022.3 Released](https://blog.jetbrains.com/ruby/2022/11/rubymine-2022-3-released/) — After an extensive early access program and round of betas, the latest incarnation of JetBrains’ (commercial) Ruby IDE is here boasting a (optional) new UI, significant improvements to working with RBS and type signatures in code generally, improved navigation of ERB templates, and more. 

JetBrains   

[Pay 6.1: A Payments Engine for Rails Apps](https://github.com/pay-rails/pay) — Supports Stripe, Paddle, Braintree, as well as a ‘fake’ processor for trials, freebies, testing, etc. There’s [a screencast](https://www.youtube.com/watch?v=hYlOmqyJIgc) showing it off, too. 

Chris Oliver   

[Free eBook: Advanced Database Programming with Rails and Postgres](https://pganalyze.com/ebooks/advanced-database-programming-rails-postgres?utm_source=RubyWeeklySecondary12012022) 

pganalyze sponsor   

[Vanilla Rails Authentication with _Authentication Zero_](https://codewithrails.com/rails-authentication) — Devise has been the go-to authentication app for Rails since forever. Still, if you want something simpler that doesn’t pollute your dependencies, Authentication Zero has a great set of features and almost zero magic. 

Simon Chiu   

[telegram-bot-ruby 0.23.0: A Ruby Wrapper for Telegram's Bot API](https://github.com/atipugin/telegram-bot-ruby) — [Telegram](https://telegram.org/) is a popular messaging app that’s particularly friendly to bots. 

Alexander Tipugin   

[Typeless: An Interpreter for Λ-Calculus Implemented in Ruby](https://github.com/gurbaaz27/typeless) 
Gurbaaz Singh Nandra   

- [ERB 4.0](https://github.com/ruby/erb/blob/master/NEWS.md#400)
 ↳ Ruby's long-time, dependable templating system.
- [Timecop 0.9.6](https://github.com/travisjeffery/timecop)
 ↳ 'Time travel' gem when testing time-dependent code.
- [Dry::Logic 1.5](https://dry-rb.org/gems/dry-logic/1.2/)
 ↳ Predicate logic with rule composition.
- [Yake 0.8](https://github.com/amancevice/yake)
 ↳ Rake-like DSL for writing AWS Lambda handlers.
- [Rails PG Extras 4.12](https://github.com/pawurb/rails-pg-extras)
 ↳ Postgres database performance insights.
- 🟨 [Material Icons for Rails 4.0](https://github.com/Angelmmiguel/material_icons)
- 🎩 [Sinatra 3.0.4](https://github.com/sinatra/sinatra)
- [Rails Event Store 2.6](https://github.com/RailsEventStore/rails_event_store)
- [Sidekiq 7.0.2](https://github.com/mperham/sidekiq)
- [Phlex 1.0.0 Release Candidate 2](https://github.com/joeldrapper/phlex/releases/tag/1.0.0.rc2)     

Jobs  

[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   

[Software Development Educator — DPI (Full Time, Hybrid, Chicago)](https://uisystemoffice.csod.com/ux/ats/careersite/5/home/requisition/274?c=uisystemoffice) — Got a passion for software development, beginner focused education, and social impact? Join us in our mission to transform lives and diversify tech talent. 
Discovery Partners Institute — University of Illinois System     

🔮 Now for something completely different..  

📗 [Know Ruby? Try Crystal for Rubyists](https://www.crystalforrubyists.com/) — A 10-chapter (but very short) online book to introduce [Crystal](https://crystal-lang.org/) (a statically typed and compiled language with Ruby-inspired syntax) to interested Rubyists. It sticks to the basics to give you an easily accessible taster. Crystal might even be a good candidate for trying _Advent of Code_with..? 

Serdar Dogruyol         

Curated by [Peter Cooper](https://x86.social/@cooper) and [Glenn Goodrich](https://twitter.com/ruprict).
Published by [Cooperpress](https://cooperpress.com/). 

[Change your email](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   

Other weekly newsletters we publish include [Postgres Weekly](https://postgresweekly.com/), [React Status](https://react.statuscode.com/), [Frontend Focus](https://frontendfoc.us/), and [JavaScript Weekly](https://javascriptweekly.com/).
