Class: Nanite::Job
Instance Attribute Summary collapse
-
#completed ⇒ Object
readonly
Returns the value of attribute completed.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#targets ⇒ Object
readonly
Returns the value of attribute targets.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #completed? ⇒ Boolean
-
#initialize(request, targets, blk) ⇒ Job
constructor
A new instance of Job.
- #process(msg) ⇒ Object
Constructor Details
#initialize(request, targets, blk) ⇒ Job
Returns a new instance of Job.
33 34 35 36 37 38 39 |
# File 'lib/nanite/job.rb', line 33 def initialize(request, targets, blk) @request = request @targets = targets @token = @request.token @results = {} @completed = blk end |
Instance Attribute Details
#completed ⇒ Object (readonly)
Returns the value of attribute completed.
31 32 33 |
# File 'lib/nanite/job.rb', line 31 def completed @completed end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
31 32 33 |
# File 'lib/nanite/job.rb', line 31 def request @request end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
31 32 33 |
# File 'lib/nanite/job.rb', line 31 def results @results end |
#targets ⇒ Object (readonly)
Returns the value of attribute targets.
31 32 33 |
# File 'lib/nanite/job.rb', line 31 def targets @targets end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
31 32 33 |
# File 'lib/nanite/job.rb', line 31 def token @token end |
Instance Method Details
#completed? ⇒ Boolean
46 47 48 |
# File 'lib/nanite/job.rb', line 46 def completed? targets.empty? end |
#process(msg) ⇒ Object
41 42 43 44 |
# File 'lib/nanite/job.rb', line 41 def process(msg) results[msg.from] = msg.results targets.delete(msg.from) end |