S
snacktime
I'm using the Eventmachine framework and being fairly new to ruby am
wondering about the best way to structure my code. Being an event
based framework there is a lot of jumping around in the code from one
callback to another.
In particular, most of the methods that I call to set callbacks take a
block. The code I want to run is usually going to be a method within
a class. For instance:
c = Transaction.new
ProtocolHandler.setcallback {|args| c.Process)
This seems to be the easiest way to get the callback to run my method
and pass it the arguments I need. Is there a better way to do this or
am I on the right track?
wondering about the best way to structure my code. Being an event
based framework there is a lot of jumping around in the code from one
callback to another.
In particular, most of the methods that I call to set callbacks take a
block. The code I want to run is usually going to be a method within
a class. For instance:
c = Transaction.new
ProtocolHandler.setcallback {|args| c.Process)
This seems to be the easiest way to get the callback to run my method
and pass it the arguments I need. Is there a better way to do this or
am I on the right track?