Class: Actors::BlockActor

Inherits:
Akka::UntypedActor
  • Object
show all
Defined in:
lib/akka/test.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(*args) ⇒ Object



23
24
25
# File 'lib/akka/test.rb', line 23

def self.create(*args)
  new(*args)
end

.spawn(&block) ⇒ Object



16
17
18
19
20
21
# File 'lib/akka/test.rb', line 16

def self.spawn(&block)
  Akka::Actors.actorOf(self).tap do |actor|
    actor.instance_variable_set(:@_block, block)
    actor.start
  end
end

Instance Method Details

#onReceive(msg) ⇒ Object



27
28
29
30
# File 'lib/akka/test.rb', line 27

def onReceive(msg)
  puts "Calling block with message #{msg}"
  @block.call(msg)
end