Class: DRbQueue::Server::Work
- Inherits:
-
Struct
- Object
- Struct
- DRbQueue::Server::Work
- Defined in:
- lib/drb_queue/server.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#worker ⇒ Object
Returns the value of attribute worker.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args
17 18 19 |
# File 'lib/drb_queue/server.rb', line 17 def args @args end |
#worker ⇒ Object
Returns the value of attribute worker
17 18 19 |
# File 'lib/drb_queue/server.rb', line 17 def worker @worker end |
Class Method Details
.unserialize(serialized) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/drb_queue/server.rb', line 22 def self.unserialize(serialized) hash = JSON.parse(serialized) worker = hash['worker'].split('::').inject(Object) { |o, k| o.const_get(k) } new(worker, hash['args']) end |
Instance Method Details
#perform ⇒ Object
18 19 20 |
# File 'lib/drb_queue/server.rb', line 18 def perform worker.perform(*args) end |
#serialize ⇒ Object
29 30 31 |
# File 'lib/drb_queue/server.rb', line 29 def serialize {'worker' => worker.to_s, 'args' => args}.to_json end |