class RFlow::Component::InputPort

An actual {Component} input port.

Public Instance Methods

add_connection(key, connection) click to toggle source

Add and start up a new {Connection}. @param key [String] the key to subscript with @param connection [Connection] the connection to add @return [void]

# File lib/rflow/component/port.rb, line 253
def add_connection(key, connection)
  super
  connection.connect_input! if connected?
end
connect!() click to toggle source

Connect all the input connections, once everything's been set up. @return [void]

# File lib/rflow/component/port.rb, line 244
def connect!
  @connections_for.each {|key, conns| conns.each {|c| c.connect_input! } }
  @connected = true
end
recv_callback=(callback) click to toggle source

Once things have been set up, registering the receive callback will set it on all connections, so that when messages are received, they are delivered on all connections with appropriate key and connection information from the context of the connection. @param callback [Proc] the receive callback @return [void]

# File lib/rflow/component/port.rb, line 264
def recv_callback=(callback)
  @connections_for.each do |key, connections|
    connections.each do |connection|
      connection.recv_callback = Proc.new do |message|
        callback.call self, key, connection, message
      end
    end
  end
end