Class: Trident::Worker
- Inherits:
-
Struct
- Object
- Struct
- Trident::Worker
- Defined in:
- lib/trident/worker.rb
Overview
Instance Attribute Summary collapse
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#pool ⇒ Object
Returns the value of attribute pool.
Instance Method Summary collapse
-
#created_at ⇒ Object
We determine the time that this worker was created from the creation timestamp on its pidfile.
-
#destroy ⇒ Object
Remove the pidfile associated with this worker.
-
#save ⇒ Object
Crate a pidfile for this worker so that we may track it.
Instance Attribute Details
#pid ⇒ Object
Returns the value of attribute pid
4 5 6 |
# File 'lib/trident/worker.rb', line 4 def pid @pid end |
#pool ⇒ Object
Returns the value of attribute pool
4 5 6 |
# File 'lib/trident/worker.rb', line 4 def pool @pool end |
Instance Method Details
#created_at ⇒ Object
We determine the time that this worker was created from the creation timestamp on its pidfile
22 23 24 |
# File 'lib/trident/worker.rb', line 22 def created_at @created_at ||= File.stat(path).ctime end |
#destroy ⇒ Object
Remove the pidfile associated with this worker
15 16 17 |
# File 'lib/trident/worker.rb', line 15 def destroy FileUtils.rm path if File.exists?(path) end |
#save ⇒ Object
Crate a pidfile for this worker so that we may track it
7 8 9 10 11 |
# File 'lib/trident/worker.rb', line 7 def save File.open(path, 'w') do |f| f << "#{pid}" end end |