Class EventFramework::EventHandler
In: event.rb
Parent: Object
WorkerThread EventDispatcher EventProcessor EventHandler NullEventHandler ChainEventHandler PrintEventHandler EventFramework EventGenerator Event EventFramework Module: EventFramework

An EventHandler specifies how an Event should be processed. Every Event contains a single EventHandler which is executed upon consumption from the event queue by the EventProcessor. The EventHandler contains the business logic that is used to process the Event.

Users are expected to either create their own subclasses that override the handle_event method. Alternatively, users can pass a block as part of the constructor. The block will be executed when handle_event is invoked.

Methods
handle_event    new    to_s   
Public Class methods
new(&block)

Creates an EventHandler. If a block is provided, it will be executed upon each invocation of handle_event. This provides a very simple means to creating handlers. The block will be passed the Event which is being handled.

Public Instance methods
handle_event(event)

Processes an Event. This method should be overridden by a concrete implementation. Alternatively, if a block was supplied to the constructor of the EventHandler, it will be executed to process the event.

If this method returns true and this handler is part of a chain (see ChainEventHandler), subsequent handlers will be permitted to process the event; otherwise, subsequent handlers are prevented from processing the Event.

event
The Event to be processed.
to_s()

Returns a string representation of the EventHandler which is simply the name of the class.