Class: Qpid::Proton::Handler::WrappedHandler
Class Method Summary
collapse
Instance Method Summary
collapse
#chandler
#impl, #impl=, included, registry
Constructor Details
#initialize(impl_or_constructor) ⇒ WrappedHandler
Returns a new instance of WrappedHandler.
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/handler/wrapped_handler.rb', line 37
def initialize(impl_or_constructor)
if impl_or_constructor.is_a?(Method)
@impl = impl_or_constructor.call
else
@impl = impl_or_constructor
Cproton.pn_incref(@impl)
end
@on_error = nil
self.class.store_instance(self)
end
|
Class Method Details
.wrap(impl, on_error = nil) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/handler/wrapped_handler.rb', line 27
def self.wrap(impl, on_error = nil)
return nil if impl.nil?
result = self.fetch_instance(impl) || WrappedHandler.new(impl)
result.on_error = on_error
return result
end
|
Instance Method Details
#add(handler) ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/handler/wrapped_handler.rb', line 48
def add(handler)
return if handler.nil?
impl = chandler(handler, self.method(:_on_error))
Cproton.pn_handler_add(@impl, impl)
Cproton.pn_decref(impl)
end
|
#clear ⇒ Object
56
57
58
|
# File 'lib/handler/wrapped_handler.rb', line 56
def clear
Cproton.pn_handler_clear(@impl)
end
|
#on_error=(on_error) ⇒ Object
60
61
62
|
# File 'lib/handler/wrapped_handler.rb', line 60
def on_error=(on_error)
@on_error = on_error
end
|