Class: Tempest::Cluster
- Inherits:
-
Object
- Object
- Tempest::Cluster
- Defined in:
- lib/tempest/cluster.rb
Instance Attribute Summary collapse
-
#loop ⇒ Object
Returns the value of attribute loop.
Instance Method Summary collapse
- #answer(who, action, job_id, args) ⇒ Object
-
#initialize(redis = 'localhost:6379') ⇒ Cluster
constructor
A new instance of Cluster.
- #on(action, &block) ⇒ Object
- #work(queue, action, args, respond_to) ⇒ Object
Constructor Details
#initialize(redis = 'localhost:6379') ⇒ Cluster
Returns a new instance of Cluster.
27 28 29 30 31 32 |
# File 'lib/tempest/cluster.rb', line 27 def initialize redis='localhost:6379' @redis = redis @_on = {} @loop = true @id = 0 end |
Instance Attribute Details
#loop ⇒ Object
Returns the value of attribute loop.
26 27 28 |
# File 'lib/tempest/cluster.rb', line 26 def loop @loop end |
Instance Method Details
#answer(who, action, job_id, args) ⇒ Object
49 50 51 |
# File 'lib/tempest/cluster.rb', line 49 def answer who, action, job_id, args Tempest.client(who).send action, job_id, args.to_json end |
#on(action, &block) ⇒ Object
34 35 36 |
# File 'lib/tempest/cluster.rb', line 34 def on action, &block @_on[action] = block end |