zeromq/rbzmq — pull request #20 by kim-toms (2012-05-14 17:29:19+00:00)
Title: Yield

This patch adds yield to block capability for Contexts and Sockets, cleaning up after the interior of the block exits, just like IO.new(). This allows you to write code such as:

```
#!/usr/bin/env ruby

require 'zmq'

ZMQ::Context.new do |ctx|
ctx.socket(ZMQ::SUB) do |sock|
sock.bind('ipc:///tmp/zmq.1')
sock.setsockopt(ZMQ::SUBSCRIBE, 'sample')
loop do
msg = sock.recv
puts msg
end
end
end
```