Class: PerfectSched::Application::Dispatch

Inherits:
Runner
  • Object
show all
Extended by:
PerfectQueue::Application::RouterDSL
Defined in:
lib/perfectsched/application/dispatch.rb

Instance Attribute Summary collapse

Attributes inherited from Runner

#task

Instance Method Summary collapse

Methods inherited from Runner

#schedules

Constructor Details

#initialize(task) ⇒ Dispatch

Runner interface



24
25
26
27
28
29
30
31
32
# File 'lib/perfectsched/application/dispatch.rb', line 24

def initialize(task)
  base = self.class.router.route(task.type)
  unless base
    task.retry!
    raise "Unknown task type #{task.type.inspect}"   # TODO error class
  end
  @runner = base.new(task)
  super
end

Instance Attribute Details

#runnerObject (readonly)

Returns the value of attribute runner.



34
35
36
# File 'lib/perfectsched/application/dispatch.rb', line 34

def runner
  @runner
end

Instance Method Details

#runObject



36
37
38
# File 'lib/perfectsched/application/dispatch.rb', line 36

def run
  @runner.run
end