I am working on a little syntactical sugar library for 0mq (networking
library). One of the things I would like to provide is a set of
asynchronous send/recv methods for transmitting and receiving messages.
The method signature would look something like this:
def send message, timeout = -1, callback, errback
end
where…
+timeout+ is the number of seconds to wait before triggering the
+errback+ Proc; -1 disables timeouts
+callback+ is the Proc/method/lambda executed upon acknowledged
completion
+errback+ is the Proc/method/lambda executed upon timeout
Ruby doesn’t allow for passing multiple blocks to a method so I’m faced
with passing Procs or methods.
Is there a more idiomatic way to accomplish my intentions?