Module: Async::Background::Job::ClassMethods

Defined in:
lib/async/background/job.rb

Instance Method Summary collapse

Instance Method Details

#options(**values) ⇒ Object



33
34
35
# File 'lib/async/background/job.rb', line 33

def options(**values)
  @options = Options.new(**values).to_h
end

#perform_async(*args, options: {}) ⇒ Object



21
22
23
# File 'lib/async/background/job.rb', line 21

def perform_async(*args, options: {})
  Async::Background::Queue.enqueue(self, *args, options: options)
end

#perform_at(time, *args, options: {}) ⇒ Object



29
30
31
# File 'lib/async/background/job.rb', line 29

def perform_at(time, *args, options: {})
  Async::Background::Queue.enqueue_at(time, self, *args, options: options)
end

#perform_in(delay, *args, options: {}) ⇒ Object



25
26
27
# File 'lib/async/background/job.rb', line 25

def perform_in(delay, *args, options: {})
  Async::Background::Queue.enqueue_in(delay, self, *args, options: options)
end

#perform_now(*args) ⇒ Object



17
18
19
# File 'lib/async/background/job.rb', line 17

def perform_now(*args)
  new.perform(*args)
end

#resolve_optionsObject



37
# File 'lib/async/background/job.rb', line 37

def resolve_options = @options || {}