Sha256: 031e1845a9fefd6f0006e05905ca64a2ce43cfec9c45927e8c6d8e74a242b29f
Contents?: true
Size: 1.07 KB
Versions: 70
Compression:
Stored size: 1.07 KB
Contents
# require "eitil_wrapper/jobs/new_job" require "eitil_wrapper/jobs/single_method_job" Kernel.module_eval do # BEWARE: _self is currently not accepted in perform_later jobs due to serialization errors # The cases of 'id' and '_self' both handle instances, with the difference # being that 'id' works for objects that have a database record, while '_self' # works for non database supported instanes, such as an Exporter instance. def new_job(_method, *args, **kwargs) if instance_methods(false).include? _method define_method "#{_method}_job" do |_self = nil, *args, **kwargs| EitilWrapper::SingleMethodJob.perform_later( *args, _class: self.class.to_s, _method: _method.to_s, id: safe_send(:id), _self: self.to_json, **kwargs ) end elsif singleton_methods(false).include? _method define_singleton_method "#{_method}_job" do |*args, **kwargs| EitilWrapper::SingleMethodJob.perform_later( *args, _class: to_s, _method: _method.to_s, **kwargs ) end end end end
Version data entries
70 entries across 70 versions & 1 rubygems