In this Ruby coding exercise your knowledge of blocks will be tested. The requirement is to build a User class that can be created and passed a block to set its values in addition to the traditional process for setting an object’s data.
Build a User Class that Can Be Passed a Block to Set Its Values.
In order to properly pass this coding exercise you’ll need to create a Ruby
User class that is flexible enough to take a block along with the traditional data setting process..
Should work, along with:
Real World Usage
Using blocks in Ruby is important when it comes to creating flexible interfaces for methods and classes. Additionally, a large number of Ruby methods optionally take a block, so it’s helpful to understand how the process works.
Can be found on the solutions branch on github.