That's what you do when you yield to the each's block. It's not like the caller calls each multiple times when it wants new data, he calls `each` once and you feed it data via the block it provides.
> Somehow data must be fed to the `each` function
Just as it "must be" fed to the `write` in your examples.
You are mistaken and confused. All IO objects in Ruby use `each` for writing out, non-IO objects use something else to write to IO objects. But from an IO object's perspective, that's a read.
Rack responses are IO objects, so they use #each to write data out. That's perfectly coherent.
That's what you do when you yield to the each's block. It's not like the caller calls each multiple times when it wants new data, he calls `each` once and you feed it data via the block it provides.
> Somehow data must be fed to the `each` function
Just as it "must be" fed to the `write` in your examples.