Yield seems to be neither object nor method. What is it? How does it access the block that is passed as an argument to the method?
Asked
Active
Viewed 114 times
1 Answers
5
yield
is a keyword, just like while
or end
or return
.
"How" it accesses the block is not really interesting, no more than "how" a return
keyword delivers a value to the calling context, or "how" an end
keyword closes a block - unless you want to dive into development of Ruby interpreter itself. The important bit for a Ruby programmer is just that that's what it does.

Amadan
- 191,408
- 23
- 240
- 301