Short Ruby Newsletter

Share this post

Short Ruby News - edition #24

newsletter.shortruby.com

Short Ruby News - edition #24

Briefly about everything happening in Ruby world

Lucian Ghinda
Jan 15
1
Share this post

Short Ruby News - edition #24

newsletter.shortruby.com

This edition covers 19 December 2022 - 8 January 2023, when I was on holiday. I was not very active on the channels I usually follow, but I tried my best to read them all retrospectively, so if I need to include something that is not here, please let me know at shortruby@ghinda.com.

This was not sent via email as it is too long and covers a different period than last week.


This edition was created with the help of Adrian Marin from Avo for Ruby on Rails (a friendly full-featured Rails admin panel) and Jakob Cosoroabă.

You can jump directly to one of the following sections if you like:

👐 Our Community

👉 All about Code and Ruby

🧰 Gems, Libraries, and Updates

🤝 Related (but not Ruby-specific)

More content: 🎥 🎧 🗞 (articles, podcasts, videos, slides, and newsletters)


👐 Our Community

👐 The main event of this period is the release of Ruby 3.2

Source: @yukihiro_matz

Read the full announcement on ruby-lang.org

👐 Ian Moss launched a community project where he invites Ruby developers across the world to contribute:

Source: ruby.social/@alterisian@c.im

Link to the Gitlab project. Read more here and here.

👐 Noah Gibbs shared that call for papers is open for Ruby Kaigi 2023:

Source: ruby.social/@codefolio

👐 Brandon Weaver shared that Ruby Learning Center will start two classes:

Source: ruby.social/@baweaver

👐 Yukihiro Matz shared a link to Ruby 30th Anniversary Event happening in 2023:

Source: @yukihiro_matz

👐 The Rubber Duck Dev Show shared they new Discord Server

👐 Kirill Shevchenko shared a list of good resources to get Ruby content in their thread:

Source: @kirill_shevch

👐 Julian Rubisch asked about what people want to learn about Ruby and Rails in 2023:

Source: @julian_rubisch

Here are some answers from the replies:

  • “Turbo Native for Android and iOS”

  • “PWAs for Rails”

  • “How to properly organize mid-sized apps so you can keep making changes and additions easily without fear”

  • “Rails internals and how everything works together, like the initialization process, how railties works ..”

  • “Hotwire”

  • “Game programming in Ruby”


👉 All about Code and Ruby

👉 Joel Drapper shared a piece of code explaining how new works in Ruby and that an object can be initialized with allocated instead of new

Source: ruby.social/@joeldrapper

Abdullah Alattas shared code sample showing alternate quoting mechanisms in Ruby:

Source: ruby.social/@Xiy
Source: ruby.social/@Xiy

👉 James Mead shared a better name for reverse_merge for Hashes that exists in Active Record - with_defaults

Source: ruby.social/@floehopper

👉 Paul Mucur wrote about two important discussions happening in Ruby:

Source: ruby.social/@mudge

Read about Project-scoped refinements and about Proposal: Import Modules

👉 Dave Copeland shared a code sample showing that `to_hash` is callend when using double-splat ** operator (check the gist on Github)

Source: ruby.social/@davetron5000

You should read the entire conversation it has good explanations. Here are two replies that adds some interesting context:

Source: ruby.social/@noelrap
Source: ruby.social/@avdi@hachyderm.io
Source: ruby.social/@noelrap

In case you want to play with this Noel Rappin shared a piece of code that you can use in this gist.

👉 Dave Copeland shared that ENV (documentation link) is a special case and should be used as such:

Source: ruby.social/@davetron5000

Peter Solnica shared that using ENV should be a anti-pattern:

Source: ruby.social/@solnic

Then Dave shared a piece of code showing how to implement your settings class. It will help if you read the entire conversation as there are good reasons for not directly referencing ENV in your code (like hard to know without grepping what ENV vars are used, your code relying on an environment you cannot control and more).

👉 Nicolas Cavigneaux shared exciting news about Ruby 3.2:

Source: ruby.social/@bounga

Another way to enable YJIT is:

Source: @fxn

👉Collin Jillbert shared a short code sample showing how to use Ruby in command line:

Source: @collin_jilbert

👉Kevin Newton shared a code sample about the loop index field in Ruby:

Source: @kddnewton

👉 пан Zverok shared a code sample showing how to use pattern matching in Ruby:

Source: @zverok

👉 Kyle Keesling shared a piece of code showing a feature that will come in Rails 7.1 (read the merged PR here)

Source: @kylekeesling

👉Tobi Lutke shared that Shopify is running Ruby 3.2 with YJIT enabled:

Source: @tobi

If you want to read a summary of improvements in Ruby 3.2 you might also want top read this thread from Ufuk Kayserilioglu:

Source: @paracycle

👉Emmanuel Hayford shared a piece of code showing a new feature of Rails 7.1 → Rails.env.local?

Source: @siaw23

👉Lázaro Nixon shared their contribution to Rails to change what is happening when replacing has_one association using the create_association method:

Source: @lazaronixon

👉 Stanislav Katkov shared a command line that helps checking syntax in a Ruby file:

Source: @5katkov

👉 みょうが shared that development for Ruby 3.3 has started:

Source: @mrkn

👉 Takashi Kokubun shared a benchmark for Ruby 3.2 YJIT:

Source: @k0kubun

Here is how the results looks like:

Source: gist.github.com/k0kubun

Another bookmark was shared Rafael Silva about using Ruby 3.2 at Discourse:

Source: @rafael_falco

And more benchmarks are shared here

👉Nate Berkopec shared why is good to decompose pages with Turbo Frames:

Benefit of decomposing pages with Turbo Frames (via Hotwire): an exception rendering one part of the page (in a frame) means only that part can't be rendered, rather than the whole page. Use the `turbo:frame-missing` event to display an error message.
Source: @nateberkopec

👉Nate Hopkins shared that all Turbo enhancing libraries now live under TurboBoost umbrella:

Source: @hopsoft

👉Collin shared about how to use Ruby debugger to know what assertions are available in a test:

Source: @collin_jilbert

👉Greg Molnar shared that in Ruby 3.2 ERB::Util.html_escape is faster than CGI.escapeHTML:

Source: @GregMolnar

👉 Lucian Ghinda shared a code sample explaining a simple refactoring guideline:

Source: @lucianghinda

👉Kirill Shevchenko recapped their best Ruby tweets in 2022:

Source: @kirill_shevch

Read them all in the thread he shared.

👉 Sebastian Wilgosz shared a Ruby tip about using :space instead of \s in regexp:

Source: @sebwilgosz

👉Jason Swett shared most common reasons for flaky tests:

Source: @JasonSwett

Here are some other replies:

  • “db record ordering”

  • “tests that depend on relative time”

  • “Mutable global state”

  • “timezones / UTC to local time conversions”

  • “not accounting for daylight savings”

There are a lot more replies to Jason's question that present some more examples of the 4 categories he shared.

👉Adrian Oprea asked about what to use for recurring jobs in Rails:

Source: @oprearocks

Among the recommendations:

  • GoodJob

  • Sidekiq with sidekiq-cron or with sidekiq_scheduler gem

  • DelayedJob

  • CloudTask via Cloudtasker gem and Cloud Run Google Serverless service

  • Schedule the jobs with Whenever

  • ruby-clocks

  • Amazon SES via shoryuken gem

  • clockwork gem

👉Timnan shared a code sample showing how to use next on Ruby for alphanumeric incrementing:

Source: @timnan101

👉Greg Navis shared a big thread with code samples describing the new features in Ruby 3.2:

Source: @gregnavis

He will show code samples for:

  • New Hook method

  • New core class: Data

  • Rest and keyword rest arguments can be forwarded anonymously

  • Ruby pattern matching - find pattern

  • Error reporting improvements

  • Procs taking one positional parameter + keyword parameters behave in less surprising way

  • Left-to-right constant assignment on explicit objects

  • Refinements and meta-programming

  • MatchData can return a byte range

  • String got three byte-level methods

But you can find more news in the thread


If you have read so far and you like the content, maybe you take into consideration sharing this and subscribing:


🧰 Gems, Libraries, and Updates

🧰 Avo shared two releases :

  • 2.23 with Timezone callable and few bugfixes. Read the release notes or read the announcement thread

  • 2.22 with Dashboards authorization, buf fixes and maintenance tasks. Read the release notes or read the announcement thread

🧰 DHH shared a new PR that will Add default Dockerfiles. You might also want to check this discussion on Fly.io forum about the Dockerfile or directly read the merged PR proposed by Sam Ruby matches node version to dev environment.

🧰 Peter Solnica shared a PR that seems to fix the issues with RSpec Mocks and Ruby 3.2

🧰 Camilo Payan shared a new release of Standard version 1.21 that comes with patches for rubocop and rubocop performance. See the changelog here

🧰 Nick Janetakis announced that the official Docker image for Ruby 3.2 was published. Check the images here

🧰 Mike Dalessio announced the release of sqlite3 v1.6.0.rc1 which ships native (pre-compiled) packages for Ruby 3.2

🧰 Two releases of Rubocop happened in the last two weeks: RuboCop 1.42 and RuboCop 1.41. Among the most interesting things that are part of Ruby 3.2 it is worth reading this commit that will allow excluding keyword arguments from the total count of Metrics/ParameterList to allow Date.define to set defaults.

🧰 Postmodern announced the release of spidr v 0.7.0. Read the changelog

Spidr is a versatile Ruby web spidering library that can spider a site, multiple domains, certain links or infinitely. Spidr is designed to be fast and easy to use.

🧰 Kevin Newton published their new Ruby parser as open source repository Yet Another Ruby Parser with the target to facilitate the following use-cases:

Anything that needs a syntax tree. This includes compilers, linters, formatters, or pretty much anything else that needs to reflect on code (source)

🧰 Ruby Lib Hunt shared a new version of HexaPDF - HexaPDF 0.28.0 making use of great performance from Ruby 3.2

🧰 Ryan Davis shared that a minitest version 5.17.0 has been released!

🧰 Jeremy Evans shared a new release of Sequel 5.64.0 Released

🧰 Hongli Lai shared that Fullstaq Ruby now provides Ruby 3.2 support, with YJIT

🧰 Hanami announced the release of Hanami v.2.0.2 with official support for Ruby 3.2 - Read the changelog

🧰 Stanislav Katkov shared a plugin he created for running on danger the ruby -c command to check file syntax: danger-rubyc


🤝 Related (but not Ruby-specific)

Tim Zoller shared a take about Scaled Agile/SAFe:

Source: ruby.social/@javahippie@freiburg.social

You might also consider reading this website safedelusion.com and the replies to Tim

🤝 Doc Norton shared a take about agile process:

Source: ruby.social/@DocOnDev@mstdn.social

🤝 Jason Swett shared a thread about why refactoring is important for good design:

Source: @JasonSwett

🤝Craig shared a Vim tip:

Source: @JalisoCSP

🤝 Nate Berkopec shared about building abstractions:

Source: @nateberkopec

🤝 Tobias Petry.Sql shared an SQL tip about Function-Based Indexes:

Source: @tobias_petry

🤝Nate Berkopec shared a take about the purpose of code reviews:

Source: @nateberkopec

🤝 Jason Swett asked a question about how to decide whether to clean up a piece of code or leave it alone:

And here are some replies:

Source: @lucianghinda
Source: @seesethcode
Source: @PatrickFoley

🤝 Luca Guidi shared a beautiful thread about lessons learned in 20 years of professional programming:

Source: @jodosha

Here are the 10 things shared by Luca:

1. Be kind.

2. Collective intelligence is better than your ego.

3. Have good health patterns: work/life balance, sleep, exercise, stay hydrated, and non-tech hobbies.

4. Be organized. Timebox.

5. Communication, transparency, and work ethic are essential with your team and non-technical stakeholders.

6. Practice deliberately.

7. Constantly acquire and share knowledge.

8. Ask for help. No one knows everything, and it's okay to admit when you don't know something.

9. Be open to feedback and willing to improve. We all make mistakes, and it's fundamental to learn from them.

10. Write clean (not smart) code. It may take more time upfront, but it will save time in the long run.


More content: 🎥 🎧 🗞

Newsletter

🗞 Joe Masilotti shared a new edition of Hotwire Dev Newsletter

🗞This Week in Rails published a couple of editions:

  • This Year in Rails, a summary of 2022!

  • Rails on Docker, local? environment inquirer and more!

  • First edition of 2023! 🥂

🗞 Ruby Radar published a couple of editions:

  • #82 - Merry Christmas from Ruby Radar🎄

  • #83 - Happy New Year!

  • #84 - One Week In

🗞 Ruby Weekly published a couple of editions:

  • Issue #635

  • Issue #634

🗞️ Ruby LibHunt published a couple of editions:

  • Issue 344 - New in Ruby 3.2 Enumerable::product

  • Issue 345 - Year in Review 2022: Tenderlove's Ruby and Rails Reflections and Predictions

  • Issue 346 - Railsapps Obituary

Podcasts

🎧 Drew Bragg published two episodes of Code and the Coding Coders who Code it:

  • Kevin Newton Episode 14

  • Jeremy Smith: Episode 13

🎧 Content For Devs published their first 2 episodes:

  • The importance of Naming things | About the podcast, Q&A and random rumbling around our stories.

  • When to start creating content?

🎧 Ruby For All published a couple of episodes:

  • Reading Source Code with Daniel Colson | Episode 22

  • Work Processes - Episode 23

  • What's Going on in 2023? - Episode 24

🎧 Jason Swett published a couple of episodes:

  • 169 - Rails Concerns with Jorge Manrubia of 37signals

  • 168 - Irina Nazarova, CEO of Evil Martians

🎧 The Ruby on Rails Podcast published a couple of episodes:

  • Episode 451: How We Hire Junior Developers with Andy Croll

  • Episode 450: Bootstrapping SaaS on Rails + Finding Community with Adam Pallozzi

  • Episode 449: New OSS Maintainers with Stefanni Brasil and Thiago Araujo

Videos

🎥 Scott Johnson shared a video created by Nick Janetakis about A Guide for Running Rails in Docker

🎥 Hanami Mastery published a new episode: Scale your app with slices!

🎥 Deanin published a couples of videos:

  • Schedule Content To Publish With Sidekiq Scheduler

  • Get Content From Followed Users With This Gem

  • Capybara System Tests With Selenium In WSL 2

  • Autosave Drafts With Stimulus And Turbo

  • Taking A Look At Scopes In Ruby On Rails 7

  • Install Ruby On Rails 7 With Docked (2 Commands!)

🎥 Alex Bacardit shared a video about RailsConf 2022 - A Rails Performance Guidebook: from 0 to 1B requests/day by Cristian Planas

🎥 Drifting Ruby published their video version of This Week in Rails - Dec 23rd, 2022

🎥 Jason Swett published the two episodes from Code With Jason Meetup: 

  • Growing Large Rails Applications

  • A different way to think about Rails models

🎥 Nate Berkopec shared their talk at RubyConfTH 2022 - Keynote: A Beginner's Guide to Puma Internals by Nate Berkopec

🎥 Tom Stuart published a new videos about Making a WebAssembly interpreter in Ruby, part 25

🎥 Sebastian Wilgosz shared a video presented by Tim Riley at RubyConfTh: RubyConfTH 2022 - Hanami 2: New Framework, New You by Tim Riley

Articles

Emmanuel Hayford shared a new article they wrote about This Week In Rails Wrapped: An Overview Of Rails 7.1 Features. Part I.

Jorge Manrubia shared a new article they wrote about Active Record, nice and blended

Denis Defreyne shared an article about Avoiding bugs in Ruby code using the state pattern

Abdullah Alattas published an article about The new built-in class: Set

Scott Johnson shared a blog post written by Nick Janetakis about A Guide for Running Rails in Docker

Adrian Marin shared an article about Rails console command made easier

Victor Shepelev  published a new article about What not to forget when implementing a pattern-matching in Ruby for custom objects

Thoughtbot shared an article about How to validate the presence of a boolean field in a Rails model

Kevin Newton finished their series with an article about instructions that are optionally compiled in Advent of YARV: Part 24

Ruby Lib Hunt shared an article about Optimizing Ruby’s Memory Layout: Variable Width Allocation

Yukihiro Matz shared a link about What I'm doing personally to improve the quality of Ruby interpreters

Ahmad Khattab published a new article about Representing boolean conditions as domain concepts

Kevin Newton shared their 2023 Resolutions

Ruby Lib Hunt shared an article written by Dinesh Gowda about Materialized View: SQL Queries on Steroids

Emmanuel Hayford published their first article about This Week In Rails Wrapped: An Overview Of Rails 7.1 Features. Part II

Nick Janetakis published an article about A Guide for Running Rails in Docker

Alessandro Rodi published a new article about Preloading associations on an Array of Objects

Eric Berry shared an article about Using Named Scopes Across Models with ActiveRecord#Merge

Hanami Mastery published an article about Hanami Mastery 2022 - Year Summary and next plans.


Thanks for reading Short Ruby Newsletter! If you enjoyed this and want to receive the newsletter weekly in your inbox, consider subscribing:

Share this post

Short Ruby News - edition #24

newsletter.shortruby.com
Comments
TopNewCommunity

No posts

Ready for more?

© 2023 Lucian Ghinda
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing