1

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?

sawa
  • 160,959
  • 41
  • 265
  • 366
Kamesh
  • 1,397
  • 1
  • 12
  • 27

1 Answers1

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
  • 179,482
  • 20
  • 216
  • 275