Sha256: e39e4bc869423fb9a85fb4cf6cd8d3fb580c510b3e4d8517781ff3a34b9d106e
Contents?: true
Size: 521 Bytes
Versions: 3
Compression:
Stored size: 521 Bytes
Contents
$:.unshift("../lib") require 'ara' class MyActor < Actor def receive(message) action = message[0] value = message[1] case action when :mult then puts "#{value} * #{value} = #{value * value}" when :add then puts "#{value} + #{value} = #{value + value}" else puts "Don't know what to do with message : #{message}" end end end myActor = Actors.actor_of(MyActor).start myActor | [:mult, 4] myActor | [:add, 4] myActor | [:something, 4] sleep 2 myActor.stop
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ara-0.0.3 | examples/actor.rb |
ara-0.0.2 | examples/actor.rb |
ara-0.0.1 | examples/actor.rb |