Manages the association between an Event and the method which should process on the context object associated with an occurance of the event.
Each type is identified by a unique type value.
@example
# SCENARIO: A part of an application handles extracting and decrypting # data received from a remote endpoint. # # An EventType is created to notify handlers that such a # situation has occurred. ENCRYPTED_RECV = 10000 # the unique constant value for the event # create a new event type which, when it occurs, invokes a method # named :on_encrypted_data when a handler is notified of its occurrance Qpid::Proton::Event::ENCRYPTED_RECV = Qpid::Proton::Event::EventType.new(ENCRYPTED_RECV, :on_encrypted_data)
@see EventBase EventBase for the rest of this example. @see Qpid::Proton::Event::Event The Event class for more details on events.
The method to invoke on any potential handler.
# File lib/event/event_type.rb, line 51 def initialize(number, method) @number = number @name = Cproton.pn_event_type_name(@number) @method = method @@types ||= {} @@types[number] = self end
@private
# File lib/event/event_type.rb, line 60 def to_s @name end