Class: Workhorse::Daemon::Worker
- Inherits:
-
Object
- Object
- Workhorse::Daemon::Worker
- Defined in:
- lib/workhorse/daemon.rb
Overview
Internal representation of a worker process. Stores worker metadata and the block to execute.
Instance Attribute Summary collapse
-
#block ⇒ Proc
readonly
The block containing the worker’s logic.
-
#id ⇒ Integer
readonly
The worker’s unique ID.
-
#name ⇒ String
readonly
The worker’s display name.
-
#pid ⇒ Integer?
The worker’s process ID when running.
Instance Method Summary collapse
-
#initialize(id, name, &block) ⇒ Worker
constructor
Creates a new worker definition.
Constructor Details
#initialize(id, name, &block) ⇒ Worker
Creates a new worker definition.
26 27 28 29 30 |
# File 'lib/workhorse/daemon.rb', line 26 def initialize(id, name, &block) @id = id @name = name @block = block end |
Instance Attribute Details
#block ⇒ Proc (readonly)
Returns The block containing the worker’s logic.
16 17 18 |
# File 'lib/workhorse/daemon.rb', line 16 def block @block end |
#id ⇒ Integer (readonly)
Returns The worker’s unique ID.
10 11 12 |
# File 'lib/workhorse/daemon.rb', line 10 def id @id end |
#name ⇒ String (readonly)
Returns The worker’s display name.
13 14 15 |
# File 'lib/workhorse/daemon.rb', line 13 def name @name end |
#pid ⇒ Integer?
Returns The worker’s process ID when running.
19 20 21 |
# File 'lib/workhorse/daemon.rb', line 19 def pid @pid end |