Class: Dataflow::Actor

Inherits:
Thread
  • Object
show all
Defined in:
lib/vendor/dataflow/dataflow/actor.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Actor

Returns a new instance of Actor.



3
4
5
6
7
8
# File 'lib/vendor/dataflow/dataflow/actor.rb', line 3

def initialize(&block)
  @stream = Variable.new
  @port = Port.new(@stream)
  # Run this block in a new thread
  super { instance_eval &block }
end

Instance Method Details

#send(message) ⇒ Object



10
11
12
# File 'lib/vendor/dataflow/dataflow/actor.rb', line 10

def send message
  @port.send message
end