2013-05-10 23:43:53 -04:00
|
|
|
module Sidekiq
|
|
|
|
module Actor
|
2014-02-01 18:04:20 -05:00
|
|
|
|
|
|
|
module ClassMethods
|
|
|
|
def trap_exit(*args)
|
|
|
|
end
|
|
|
|
def new_link(*args)
|
|
|
|
new(*args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
module InstanceMethods
|
|
|
|
def current_actor
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def after(interval)
|
|
|
|
end
|
|
|
|
def alive?
|
|
|
|
!@dead
|
|
|
|
end
|
|
|
|
def terminate
|
|
|
|
@dead = true
|
|
|
|
end
|
2014-02-01 18:15:03 -05:00
|
|
|
def defer
|
|
|
|
yield
|
|
|
|
end
|
2014-02-01 18:04:20 -05:00
|
|
|
end
|
|
|
|
|
2013-06-08 01:15:13 -04:00
|
|
|
def self.included(klass)
|
2014-02-01 18:04:20 -05:00
|
|
|
if $TESTING
|
2014-02-14 09:43:34 -05:00
|
|
|
klass.__send__(:include, InstanceMethods)
|
|
|
|
klass.__send__(:extend, ClassMethods)
|
2014-02-01 18:04:20 -05:00
|
|
|
else
|
2014-02-14 09:43:34 -05:00
|
|
|
klass.__send__(:include, Celluloid)
|
2014-02-01 18:04:20 -05:00
|
|
|
end
|
2013-05-10 23:43:53 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|