Module: Qwirk::BaseWorker

Included in:
Qwirk::Batch::FileWorker, Worker
Defined in:
lib/qwirk/base_worker.rb

Overview

TODO: Is this necessary anymore or just put in worker.rb? Decide when flat file adapter is implemented.

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

Returns the value of attribute config.



7
8
9
# File 'lib/qwirk/base_worker.rb', line 7

def config
  @config
end

#indexObject

Returns the value of attribute index.



7
8
9
# File 'lib/qwirk/base_worker.rb', line 7

def index
  @index
end

Class Method Details

.included(base) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/qwirk/base_worker.rb', line 57

def self.included(base)
  Rumx::Bean.included(base)
  base.extend(ClassMethods)
  if base.kind_of?(Class)
    @worker_classes ||= []
    @worker_classes << base unless @worker_classes.include?(base)
  end
end

.worker_classesObject



66
67
68
# File 'lib/qwirk/base_worker.rb', line 66

def self.worker_classes
  @worker_classes ||= []
end

Instance Method Details

#statusObject



74
75
76
# File 'lib/qwirk/base_worker.rb', line 74

def status
  raise "Need to override status method in #{self.class.name}"
end

#stopObject



70
71
72
# File 'lib/qwirk/base_worker.rb', line 70

def stop
  raise "Need to override stop method in #{self.class.name}"
end

#to_sObject



78
79
80
# File 'lib/qwirk/base_worker.rb', line 78

def to_s
  "#{config.name}:#{index}"
end