The two common ways to call a Ruby block - Code with Jason

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 #code https://rubyonrails.ba/single/the-two-common-ways-to-call-a-ruby-block-code-with-jason

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles