Sha256: 1377dfac483403780db9653dc9f538adc1b676aadbf58ee78cfc7c138cb0719f
Contents?: true
Size: 688 Bytes
Versions: 1
Compression:
Stored size: 688 Bytes
Contents
# http://gist.github.com/596822 require 'rubygems' require 'ruote' pdef = Ruote.process_definition do repeat do ping # mister ping, please shoot first pong end end class Opponent include Ruote::LocalParticipant def initialize (options) @options = options end def consume (workitem) puts @options['sound'] reply_to_engine(workitem) end end engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new)) engine.register_participant :ping, Opponent, 'sound' => 'ping' engine.register_participant :pong, Opponent, 'sound' => 'pong' wfid = engine.launch(pdef) sleep 5 # five seconds of ping pong fun engine.cancel_process(wfid) # game over
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruote-2.1.11 | examples/pong.rb |