Class: Qpid::Proton::Handler::CAdaptor
- Inherits:
-
Object
- Object
- Qpid::Proton::Handler::CAdaptor
- Defined in:
- lib/handler/c_adaptor.rb
Instance Method Summary collapse
- #dispatch(cevent, ctype) ⇒ Object
- #exception(error) ⇒ Object
-
#initialize(handler, on_error = nil) ⇒ CAdaptor
constructor
A new instance of CAdaptor.
Constructor Details
#initialize(handler, on_error = nil) ⇒ CAdaptor
Returns a new instance of CAdaptor.
25 26 27 28 |
# File 'lib/handler/c_adaptor.rb', line 25 def initialize(handler, on_error = nil) @handler = handler @on_error = on_error end |
Instance Method Details
#dispatch(cevent, ctype) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/handler/c_adaptor.rb', line 30 def dispatch(cevent, ctype) event = Qpid::Proton::Event::Event.wrap(cevent, ctype) # TODO add a variable to enable this programmatically # print "EVENT: #{event} going to #{@handler}\n" event.dispatch(@handler) end |
#exception(error) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/handler/c_adaptor.rb', line 37 def exception(error) if @on_error.nil? raise error else @on_error.call(error) end end |