Class: Job
Class Method Summary collapse
-
.active ⇒ Object
Return array of active jobs.
-
.for(agent) ⇒ Object
Return active job for agent.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Check if the job is active.
-
#to_json ⇒ Object
Job JSON.
Class Method Details
.active ⇒ Object
Return array of active jobs.
64 65 66 |
# File 'lib/swarm/job.rb', line 64 def self.active all :active => true end |
.for(agent) ⇒ Object
Return active job for agent.
55 56 57 58 59 |
# File 'lib/swarm/job.rb', line 55 def self.for agent active.find do |job| not agent.jobs.include?(job) || job.agents.any? { |other| agent.string == other.string } end end |
Instance Method Details
#active? ⇒ Boolean
Check if the job is active.
33 34 35 |
# File 'lib/swarm/job.rb', line 33 def active? active end |
#to_json ⇒ Object
Job JSON.
40 41 42 43 44 45 46 |
# File 'lib/swarm/job.rb', line 40 def to_json { :id => id, :source => source, :results => results, :address => address, :active => active }.to_json end |