Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Greeting
- attr_accessor :who
- end
- class GreetingActor
- include Celluloid
- def initialize
- async.wait_for_msg
- end
- def wait_for_msg
- loop do
- receive { |msg|
- if msg.is_a? Greeting
- puts "Hello " + msg.who
- end
- }
- end
- end
- end
- greeter = GreetingActor.new
- greeting = Greeting.new
- greeting.who = "Dr Who"
- greeter.mailbox << greeting
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement