Class: JobDispatch::Broker::Command
- Inherits:
-
Object
- Object
- JobDispatch::Broker::Command
- Defined in:
- lib/job_dispatch/broker/command.rb
Instance Attribute Summary collapse
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#worker_id ⇒ Object
Returns the value of attribute worker_id.
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize(worker_id = nil, parameters = nil) ⇒ Command
constructor
A new instance of Command.
- #queue ⇒ Object
- #status ⇒ Object
- #success? ⇒ Boolean
-
#worker_name ⇒ Object
the name of the worker.
- #worker_ready? ⇒ Boolean
Constructor Details
#initialize(worker_id = nil, parameters = nil) ⇒ Command
Returns a new instance of Command.
14 15 16 |
# File 'lib/job_dispatch/broker/command.rb', line 14 def initialize(worker_id=nil, parameters=nil) @worker_id, @parameters = worker_id, parameters end |
Instance Attribute Details
#parameters ⇒ Object
Returns the value of attribute parameters.
12 13 14 |
# File 'lib/job_dispatch/broker/command.rb', line 12 def parameters @parameters end |
#worker_id ⇒ Object
Returns the value of attribute worker_id.
11 12 13 |
# File 'lib/job_dispatch/broker/command.rb', line 11 def worker_id @worker_id end |
Instance Method Details
#command ⇒ Object
26 27 28 |
# File 'lib/job_dispatch/broker/command.rb', line 26 def command @parameters[:command] end |
#queue ⇒ Object
22 23 24 |
# File 'lib/job_dispatch/broker/command.rb', line 22 def queue (@parameters[:queue] || :default).to_sym end |
#status ⇒ Object
30 31 32 |
# File 'lib/job_dispatch/broker/command.rb', line 30 def status @parameters[:status] && @parameters[:status].to_sym end |
#success? ⇒ Boolean
34 35 36 |
# File 'lib/job_dispatch/broker/command.rb', line 34 def success? status == :success end |
#worker_name ⇒ Object
the name of the worker
39 40 41 |
# File 'lib/job_dispatch/broker/command.rb', line 39 def worker_name @parameters[:worker_name] end |
#worker_ready? ⇒ Boolean
18 19 20 |
# File 'lib/job_dispatch/broker/command.rb', line 18 def worker_ready? @parameters[:command] == "ready" || @parameters[:ready] end |