How to do Events in Ruby?

Ash picture Ash · Mar 3, 2009 · Viewed 13.9k times · Source

I come from a C# background, and have just started programming in Ruby. The thing is, that I need to know how I can raise events in my classes so that various observers can be triggered when things need to happen.

The problem is the books I have on Ruby don't even mention events, let alone provide examples. Is anyone able to help me?

Answer

bojo picture bojo · Mar 3, 2009

The question has already been answered, but there's an observer built right into the standard library if you want to give that a look. I've used it in the past for a small game project, and it works very well.