Short Notes
March 15th, 2024

A small example about how Ruby is evolving

A small example about how #Ruby is evolving. 

I took a code sample from a feature request from 2011 and wrote it using features that will be available in Ruby 3.4

Example of refactoring using endless method
Example of refactoring using endless method

In case you are wondering, _1 is called a numbered block parameter, and in this case, it is a shorthand syntax for the first parameter in that block.

Example of numbered block params
Example of numbered block params

You can play with it block param already using https://ruby-next.github.io

Reply to this on Twitter, Mastodon, or Linkedin