Where Do Ruby Blocks Come From?
Welcome, new subscribers! π The launch of RUBY3.dev was a huge success, and I'm grateful for all the interest and positive feedback. This community rocks! π€
β
This week's article is titled Where Do Ruby Blocks Come From?β
β
Blocks in Ruby are powerful, and theyβre used everywhere. You can pass blocks implicitly to enumerable methods like map and select simply by adding { ... } or do ... end after the method name. You can explicitly create closures (aka anonymous functions) by using proc, lambda, or ->() semantics and pass them around as method arguments or store them as variables. Yes, blocks are pretty magical.
β
But weβre not here to talk about how to write blocks per se or what theyβre good for. Weβre here to talk about where they come from.
β
βLet's Do This!β
β