The two common ways to call a Ruby block - Code with Jason
09-Dec-2021 1602
Ruby blocks can be difficult to understand. One of the details which presents an obstacle to fully understanding blocks is the fact that there is more than one way to call a block.In this post we’ll go over the two common ways of calling a Ruby block: block.call and yield.There are also other ways to call a block, e.g. something called instance_exec. But that’s an “advanced” topic which I’ll leave out of the scope of this post.Here are the two common ways of calling a Ruby block and why they exist.
The two common ways to call a Ruby block - Code with Jason #ruby #rubydeveloper #rubyonrails #common #block #Jason #code https://rubyonrails.ba/link/the-two-common-ways-to-call-a-ruby-block-code-with-jason