Skip to content
This repository
tree: dbc5e37c4d
Fetching contributors…

Cannot retrieve contributors at this time

file 17 lines (16 sloc) 0.51 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
module Delayed
  module MessageSending
    def send_later(method, *args)
      Delayed::Job.enqueue Delayed::PerformableMethod.new(self, method.to_sym, args)
    end
    
    module ClassMethods
      def handle_asynchronously(method)
        without_name = "#{method}_without_send_later"
        define_method("#{method}_with_send_later") do |*args|
          send_later(without_name, *args)
        end
        alias_method_chain method, :send_later
      end
    end
  end
end
Something went wrong with that request. Please try again.