E
Edgardo Hames
I'm back writing my small network app (IM client) and I need to
dispatch functions based on the messages received from the server. For
example, if my app gets a string like
MSG msg_number som_other_text
it should call the function process_MSG and pass some_other_text as an argument.
How can I do that? I was thinking of a big case statement, but I'm not
sure that's the Ruby Way. Probably a hash with MSGs as keys and
process_MSGs as values?
Thanks for your ideas,
Ed
dispatch functions based on the messages received from the server. For
example, if my app gets a string like
MSG msg_number som_other_text
it should call the function process_MSG and pass some_other_text as an argument.
How can I do that? I was thinking of a big case statement, but I'm not
sure that's the Ruby Way. Probably a hash with MSGs as keys and
process_MSGs as values?
Thanks for your ideas,
Ed