Pass Multiple Blocks to a Method by Leveraging Lambdas in Ruby
In many cases, lambdas are the most effective when they’re used in conjunction with methods. A method is limited to taking a single block in Ruby, however by leveraging lambdas you are able to pass in as many blocks as needed.
Implement a method that can accept multiple blocks by leveraging lambdas.
Build a method that takes multiple lambdas as arguments in order to illustrate how a single method can be passed multiple blocks as arguments.
Real World Usage
By default, a method in Ruby is limited to only receiving a single block as an argument. This is where lambdas (also known as closures in other languages) are able to extend the functionality of a single method. A method can take an unlimited number of lambdas as argument, so therefore lambdas allow you to give plain Ruby methods the ability to accept multiple blocks as arguments. This exercise helps to showcase this behavior by building a User tracking solution.
Can be found on the solutions branch on github.