Module: Paradin::Task

Included in:
Base
Defined in:
lib/paradin/task.rb

Instance Method Summary collapse

Instance Method Details

#asyncObject



11
12
13
14
15
16
17
# File 'lib/paradin/task.rb', line 11

def async
  if rails?
    raise NotSupported.new("Async task execution is not supported in Rails.")
  end

  execute!
end

#awaitObject



19
20
21
22
23
# File 'lib/paradin/task.rb', line 19

def await
  lock_autoload_if_necessary do
    execute!.map(&:value!)
  end
end

#enqueue(*args, **kwargs) ⇒ Object



5
6
7
8
9
# File 'lib/paradin/task.rb', line 5

def enqueue(*args, **kwargs)
  context = Context.new(*args, **kwargs)
  context_queue.push(context)
  nil
end