Module: Raemon::Worker::InstanceMethods

Defined in:
lib/raemon/worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/raemon/worker.rb', line 9

def id
  @id
end

#loggerObject (readonly)

Returns the value of attribute logger.



9
10
11
# File 'lib/raemon/worker.rb', line 9

def logger
  @logger
end

#masterObject (readonly)

Returns the value of attribute master.



9
10
11
# File 'lib/raemon/worker.rb', line 9

def master
  @master
end

#pidObject (readonly)

Returns the value of attribute pid.



9
10
11
# File 'lib/raemon/worker.rb', line 9

def pid
  @pid
end

#pulseObject (readonly)

Returns the value of attribute pulse.



9
10
11
# File 'lib/raemon/worker.rb', line 9

def pulse
  @pulse
end

Instance Method Details

#==(other_id) ⇒ Object



19
20
21
# File 'lib/raemon/worker.rb', line 19

def ==(other_id)
  @id == other_id
end

#heartbeat!Object



27
28
29
# File 'lib/raemon/worker.rb', line 27

def heartbeat!
  master.worker_heartbeat!(self)
end

#initialize(master, id, pulse) ⇒ Object



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

def initialize(master, id, pulse)
  @master = master
  @logger = master.logger
  @id     = id
  @pid    = $$
  @pulse  = pulse
end

#runObject



23
24
25
# File 'lib/raemon/worker.rb', line 23

def run
  raise "Abstract method"
end