We are asked to refactor total_stock to use the new block shortcut. I really wasn’t sure how best to do that. I tried adding a new field to the OpenStructs like so:
I do not believe there is an “intended solution”. In other words, the tests themselves do not dictate any specific solution. So this is more of a “understand the use and concept of this syntax”.
Since you have used the “new block syntax” I would count that as at least half done. The rest is left up to you to know that it can be used and what it does.
If you request mentoring for that exercise, though, the mentor that picks up may see your progression, and may understand more of what you have gone through.
The instructions are just wrong I think. It should be asking you to use the method from the openstruct, not the hash. Whereas it’s asking to use the new block syntax. Sorry. PR below.