Class: Rector::Worker
- Inherits:
-
Object
- Object
- Rector::Worker
- Defined in:
- lib/rector/worker.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(id) ⇒ Worker
constructor
A new instance of Worker.
- #job_id ⇒ Object
Constructor Details
#initialize(id) ⇒ Worker
Returns a new instance of Worker.
5 6 7 8 9 10 11 |
# File 'lib/rector/worker.rb', line 5 def initialize(id) @id = id @data = Hash.new @backend = Rector.backend_for(job_id) @backend.add_worker(@id) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/rector/worker.rb', line 3 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/rector/worker.rb', line 3 def id @id end |
Instance Method Details
#finish ⇒ Object
17 18 19 20 |
# File 'lib/rector/worker.rb', line 17 def finish @backend.update_job_data_from_hash(@data) @backend.finish_worker(@id) end |
#job_id ⇒ Object
13 14 15 |
# File 'lib/rector/worker.rb', line 13 def job_id @id.split(":").first end |