Module: ModernTimes::Base::Worker

Included in:
JMS::Worker
Defined in:
lib/modern_times/base/worker.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#indexObject

Returns the value of attribute index.



5
6
7
# File 'lib/modern_times/base/worker.rb', line 5

def index
  @index
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/modern_times/base/worker.rb', line 4

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/modern_times/base/worker.rb', line 4

def options
  @options
end

#threadObject

Returns the value of attribute thread.



5
6
7
# File 'lib/modern_times/base/worker.rb', line 5

def thread
  @thread
end

Class Method Details

.included(base) ⇒ Object



18
19
20
# File 'lib/modern_times/base/worker.rb', line 18

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#initialize(options = {}) ⇒ Object



22
23
24
25
# File 'lib/modern_times/base/worker.rb', line 22

def initialize(options={})
  @name = options[:name] || self.class.default_name
  @options = options
end

#joinObject



39
40
41
# File 'lib/modern_times/base/worker.rb', line 39

def join
  thread.join
end

#setupObject

One time initialization prior to first thread



28
29
# File 'lib/modern_times/base/worker.rb', line 28

def setup
end

#startObject



31
32
33
# File 'lib/modern_times/base/worker.rb', line 31

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

#statusObject



43
44
45
# File 'lib/modern_times/base/worker.rb', line 43

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

#stopObject



35
36
37
# File 'lib/modern_times/base/worker.rb', line 35

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