lib/celluloid.rb in celluloid-0.12.2 vs lib/celluloid.rb in celluloid-0.12.3
- old
+ new
@@ -144,13 +144,20 @@
def run(*args, &block)
new(*args, &block).join
end
# Trap errors from actors we're linked to when they exit
- def trap_exit(callback)
- @exit_handler = callback.to_sym
+ def exit_handler(callback = nil)
+ if callback
+ @exit_handler = callback.to_sym
+ elsif defined?(@exit_handler)
+ @exit_handler
+ elsif superclass.respond_to? :exit_handler
+ superclass.exit_handler
+ end
end
+ alias_method :trap_exit, :exit_handler
# Configure a custom mailbox factory
def use_mailbox(klass = nil, &block)
if block
@mailbox_factory = block
@@ -200,10 +207,10 @@
# Configuration options for Actor#new
def actor_options
{
:mailbox => mailbox_factory,
- :exit_handler => @exit_handler,
+ :exit_handler => exit_handler,
:exclusive_methods => @exclusive_methods,
:task_class => task_class
}
end