Endless Method Definition in Ruby
A new method definition was introduced in Ruby 3.0, the endless definition.
You're probably familiar with:
Of course, we can express this as a one-liner previously as:
Now you have the option to write it like this:
Or another example:
If you'd like to know more, here is where the spec was discussed
Tweet