class Serially::InstanceBase

Public Class Methods

new(instance) click to toggle source
# File lib/serially/instance_base.rb, line 5
def initialize(instance)
  @instance = instance
  @task_manager = Serially::TaskManager[instance.class]
end

Public Instance Methods

start!() click to toggle source
# File lib/serially/instance_base.rb, line 13
def start!
  Serially::Job.enqueue(@instance.class, @instance.instance_id, @task_manager.queue)
end
task_runs() click to toggle source
# File lib/serially/instance_base.rb, line 17
def task_runs
  raise NotSupportedError.new('Serially: task_runs query is supported only for ActiveRecord classes') unless @instance.class.is_active_record?
  Serially::TaskRun.where(item_class: @instance.class.to_s, item_id: @instance.id).order('task_order ASC')
end