module Laters::Concern
Public Instance Methods
run_in_queue(queue)
click to toggle source
# File lib/laters/concern.rb, line 15 def run_in_queue(queue) @job_queue = queue end
Private Instance Methods
deferrable_method_name(deferring_method)
click to toggle source
@param [Symbol] deferring_method Name of the deferring method that was called
# File lib/laters/concern.rb, line 37 def deferrable_method_name(deferring_method) return unless (method = deferring_method.to_s).ends_with? '_later' method.chomp! '_later' if respond_to? "#{method}!", true "#{method}!" elsif respond_to? method, true method end end
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/laters/concern.rb, line 22 def method_missing(method, *args, &block) if (method_to_call = deferrable_method_name(method)) InstanceMethodJob .set(queue: self.class.job_queue || :default) .perform_later(self, method_to_call, *args) else super end end
respond_to_missing?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/laters/concern.rb, line 32 def respond_to_missing?(method_name, include_private = false) method_name.to_s.ends_with?('_later') || super end