Module: Kryten::Weaver
- Included in:
- ThreadedTask
- Defined in:
- lib/kryten/weaver.rb
Instance Attribute Summary collapse
-
#worker ⇒ Object
readonly
Returns the value of attribute worker.
-
#workers ⇒ Object
Returns the value of attribute workers.
Instance Method Summary collapse
Instance Attribute Details
#worker ⇒ Object (readonly)
Returns the value of attribute worker.
2 3 4 |
# File 'lib/kryten/weaver.rb', line 2 def worker @worker end |
#workers ⇒ Object
Returns the value of attribute workers.
3 4 5 |
# File 'lib/kryten/weaver.rb', line 3 def workers @workers end |
Instance Method Details
#start_work ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/kryten/weaver.rb', line 5 def start_work workers.each(&:start_work) if workers if worker && worker.alive? log 'worker already running' return false end @worker = Thread.new { start } end |
#stop_work ⇒ Object
15 16 17 18 |
# File 'lib/kryten/weaver.rb', line 15 def stop_work workers.each(&:stop_work) if workers stop_running end |