module Quebert::AsyncSender::Promise::DSL

Methods/DSL that we mix into classes, objects, etc. so that we can easily enqueue jobs to these.

Public Instance Methods

async(opts={}) click to toggle source
# File lib/quebert/async_sender/promise.rb, line 38
def async(opts={})
  Promise.new(self, opts) { |job| job.enqueue }
end
async_send(*args) click to toggle source

Legacy way of enqueueing jobs.

# File lib/quebert/async_sender/promise.rb, line 43
def async_send(*args)
  meth = args.shift
  beanstalk = args.last.delete(:beanstalk) if args.last.is_a?(::Hash)

  Quebert.deprecate "#async_send should be called via #{self.class.name}.async(#{beanstalk.inspect}).#{args.first}(#{args.map(&:inspect).join(', ')})" do
    async(beanstalk || {}).send(meth, *args)
  end
end