1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/lib/sidekiq/actor.rb
Sean Doyle e12bf878fa Replaced class and instance level send
Replaced with `__send__` from std lib

* `send` can now be overridden to be more semantically meaningful
  * `message.send(user_id)` as opposed to `message.send_message(user_id)`
* `__send__` makes it clear that the reflective version is intended
2014-02-14 09:43:34 -05:00

38 lines
634 B
Ruby

module Sidekiq
module Actor
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
def defer
yield
end
end
def self.included(klass)
if $TESTING
klass.__send__(:include, InstanceMethods)
klass.__send__(:extend, ClassMethods)
else
klass.__send__(:include, Celluloid)
end
end
end
end