Module: Patella::SendLater

Defined in:
lib/patella/send_later.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/patella/send_later.rb', line 3

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#send_later(method_name, *args) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/patella/send_later.rb', line 7

def send_later method_name, *args
  #in dev mode, run the command in process
  if Rails.caching?
    Patella::SendLaterWorker.perform_later self.class.to_s, self.id, method_name, *args
  else
    self.send method_name, *args
  end
end