Ruby 3.4 Highlights
blog.sinjakli.co.uk
Ruby 3.4 Highlights
1–10 of 86 posts
Re: Ruby 3.4 Highlights
#2Re: Ruby 3.4 Highlights
#3> [
> "beige chinos",
> "blue jorts",
> "rainbow jorts",
> ].filter { it =~ /jorts/ }
> # => ["blue jorts", "rainbow jorts"]
This reminds me of Perl's $_ (which in Ruby is last line read from STDIN).
Re: Ruby 3.4 Highlights
#4Re: Ruby 3.4 Highlights
#5Re: Ruby 3.4 Highlights
#6Re: Ruby 3.4 Highlights
#7> In Ruby 3.4, it has been added as a default name for the first parameter passed to a block. Rather than specifying a name in trivial cases like the one above, you can now write: > [ > "beige chinos", > "blue jorts", > "rainbow jorts", > ].filter { it =~ /jorts/ } > # => ["blue jorts", "rainbow jorts"] This reminds me of Perl's $_ (which in Ruby is last line read from STDIN).
Re: Ruby 3.4 Highlights
#8The default block parameter name seems small, but I feel like I'm gonna use it all the time, especially when I'm in the Rails console just trying to debug data
Re: Ruby 3.4 Highlights
#9The default block parameter name seems small, but I feel like I'm gonna use it all the time, especially when I'm in the Rails console just trying to debug data
Kotlin also has it, I can tell you that it's really useful
Re: Ruby 3.4 Highlights
#10I remember thinking it clashed a bit with the idea of trying to make the code read like natural language.