Module: Quebert::AsyncSender::Instance::ClassMethods
- Defined in:
- lib/quebert/async_sender/instance.rb
Instance Method Summary collapse
-
#overwrite_initialize ⇒ Object
Hack into the class initialize method so that we can grab the arguments used to create an instance of the class that we can serialize into a job.
Instance Method Details
#overwrite_initialize ⇒ Object
Hack into the class initialize method so that we can grab the arguments used to create an instance of the class that we can serialize into a job.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/quebert/async_sender/instance.rb', line 46 def overwrite_initialize class_eval do unless method_defined?(:initialize_with_async_sender) define_method(:initialize_with_async_sender) do initialize_without_async_sender end end if instance_method(:initialize) != instance_method(:initialize_with_async_sender) alias_method :initialize_without_async_sender, :initialize alias_method :initialize, :initialize_with_async_sender end end end |