Class: Soda::Worker::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/soda/worker.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass, options) ⇒ Options

Returns a new instance of Options.



4
5
6
7
# File 'lib/soda/worker.rb', line 4

def initialize(klass, options)
  @klass    = klass
  @options  = options
end

Instance Method Details

#perform_async(*args) ⇒ Object



15
16
17
# File 'lib/soda/worker.rb', line 15

def perform_async(*args)
  perform_in(0, *args)
end

#perform_in(delay, *args) ⇒ Object Also known as: perform_at



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/soda/worker.rb', line 19

def perform_in(delay, *args)
  tap do
    client = Soda::Client.new
    client.push(
      options.merge(
        "delay" => delay,
        "klass" => klass,
        "args"  => args,
      ),
    )
  end
end

#set(opts = {}) ⇒ Object



9
10
11
12
13
# File 'lib/soda/worker.rb', line 9

def set(opts = {})
  tap do
    options.merge!(opts)
  end
end