Introduction
In the previous chapters, we learned how to debug Ruby programs using the logger
class. In this chapter, we will learn about some of the advanced topics of the Ruby programming language, such as blocks
, procs
, and lambdas
. By now, you must have realized that it's really easy to start writing Ruby code, create sample apps, and get instant gratification; however, every new Ruby developer (and sometimes the experienced ones too) will have a question buzzing in their mind about how it actually works.
We can safely call it the Ruby magic, and that's what we are planning to crack in this chapter. We are going to learn about advanced programming techniques that are present in other languages, but this time the Ruby-specific implementation is our focus. We will tear down the curtain from the syntactic sugar and take a look under the hood to reveal what metaprogramming is. Additionally, we will lay a strong foundation that will allow you to reuse these techniques and...