Short Ruby News - edition #24

Briefly about everything happening in Ruby world

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 [email protected].

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

More content: πŸŽ₯ 🎧 πŸ—ž (articles, podcasts, videos, slides, and newsletters)

πŸ‘ Our Community

πŸ‘ The main event of this period is the release of Ruby 3.2

Read the full announcement on ruby-lang.org

πŸ‘ Ian Moss launched a community project where he invites Ruby developers across the world to contribute:

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

πŸ‘ Brandon Weaver shared that Ruby Learning Center will start two classes:

πŸ‘ Yukihiro Matz shared a link to Ruby 30th Anniversary Event happening in 2023:

πŸ‘ Kirill Shevchenko shared a list of good resources to get Ruby content in their thread:

πŸ‘ Julian Rubisch asked about what people want to learn about Ruby and Rails in 2023:

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

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

πŸ‘‰ James Mead shared a better name for reverse_merge for Hashes that exists in Active Record - with_defaults

πŸ‘‰ Paul Mucur wrote about two important discussions happening in Ruby:

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

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

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:

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

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:

Another way to enable YJIT is:

πŸ‘‰Collin Jillbert shared a short code sample showing how to use Ruby in command line:

πŸ‘‰Kevin Newton shared a code sample about the loop index field in Ruby:

πŸ‘‰ ΠΏΠ°Π½ Zverok shared a code sample showing how to use pattern matching in Ruby:

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

πŸ‘‰Tobi Lutke shared that Shopify is running Ruby 3.2 with YJIT enabled:

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

πŸ‘‰Emmanuel Hayford shared a piece of code showing a new feature of Rails 7.1 β†’ Rails.env.local?

πŸ‘‰LΓ‘zaro Nixon shared their contribution to Rails to change what is happening when replacing has_one association using the create_association method:

πŸ‘‰ Stanislav Katkov shared a command line that helps checking syntax in a Ruby file:

πŸ‘‰ γΏγ‚‡γ†γŒ shared that development for Ruby 3.3 has started:

πŸ‘‰ Takashi Kokubun shared a benchmark for Ruby 3.2 YJIT:

Here is how the results looks like:

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

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.

πŸ‘‰Nate Hopkins shared that all Turbo enhancing libraries now live under TurboBoost umbrella:

πŸ‘‰Collin shared about how to use Ruby debugger to know what assertions are available in a test:

πŸ‘‰Greg Molnar shared that in Ruby 3.2 ERB::Util.html_escape is faster than CGI.escapeHTML:

πŸ‘‰ Lucian Ghinda shared a code sample explaining a simple refactoring guideline:

πŸ‘‰Kirill Shevchenko recapped their best Ruby tweets in 2022:

πŸ‘‰ Sebastian Wilgosz shared a Ruby tip about using :space instead of \s in regexp:

πŸ‘‰Jason Swett shared most common reasons for flaky tests:

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:

Among the recommendations:

πŸ‘‰Timnan shared a code sample showing how to use next on Ruby for alphanumeric incrementing:

πŸ‘‰Greg Navis shared a big thread with code samples describing the new features in Ruby 3.2:

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

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 :

🧰 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

🧰 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:

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

🀝 Doc Norton shared a take about agile process:

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

🀝Craig shared a Vim tip:

🀝 Nate Berkopec shared about building abstractions:

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

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

🀝 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:

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

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:

πŸ—ž Ruby Radar published a couple of editions:

πŸ—ž Ruby Weekly published a couple of editions:

πŸ—žοΈ Ruby LibHunt published a couple of editions:

Podcasts

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

🎧 Content For Devs published their first 2 episodes:

🎧 Ruby For All published a couple of episodes:

🎧 Jason Swett published a couple of episodes:

🎧 The Ruby on Rails Podcaspublished a couple of episodes:

Videos

πŸŽ₯ Hanami Mastery published a new episode: Scale your app with slices!

πŸŽ₯ Deanin published a couples of videos:

πŸŽ₯ 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: 

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

Articles

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

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

Reply

or to participate.