Bindings in Ruby – Behind the Magic of Blocks
Why block can see local variables defined before him? Why can it change them? What kind of sorcery is this? I will try to answer that question in this post. We will see examples of blocks and hidden secret hero behind the magic – binding object.
In our magical journey, we will look into some Ruby code and some CRuby internals to help us better understand the magic.
Great magicians never reveal their secrets – but thankfully Ruby is open source, so we can lift the veil and see the real truth behind it. And believe me, it’s quite beautiful!
https://blog.rebased.pl/2017/11/30/bindings-in-ruby-behind-the-magic-of-blocks.html
Post a comment