Class: Userlist::Push::Strategies::ActiveJob

Inherits:
Object
  • Object
show all
Defined in:
lib/userlist/push/strategies/active_job.rb,
lib/userlist/push/strategies/active_job/worker.rb

Defined Under Namespace

Classes: Worker

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ ActiveJob

Returns a new instance of ActiveJob.



9
10
11
# File 'lib/userlist/push/strategies/active_job.rb', line 9

def initialize(config = {})
  @config = Userlist.config.merge(config)
end

Instance Method Details

#call(*args) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/userlist/push/strategies/active_job.rb', line 13

def call(*args)
  options = default_options.merge(self.options)

  worker_name = options.delete(:class)
  worker_class = Object.const_get(worker_name)
  worker_class
    .set(options)
    .perform_later(*normalize(args))
end