Class: RFlow::Component::InputPort
- Defined in:
- lib/rflow/component/port.rb
Overview
An actual RFlow::Component input port.
Instance Attribute Summary
Attributes inherited from HashPort
Attributes inherited from Port
Instance Method Summary collapse
-
#add_connection(key, connection) ⇒ void
Add and start up a new RFlow::Connection.
-
#connect! ⇒ void
Connect all the input connections, once everything’s been set up.
-
#recv_callback=(callback) ⇒ void
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.
Methods inherited from HashPort
#[], #all_connections, #collect_messages, #connections_for, #direct_connect, #each, #initialize, #keys, #remove_connection, #send_message
Methods inherited from Port
Constructor Details
This class inherits a constructor from RFlow::Component::HashPort
Instance Method Details
#add_connection(key, connection) ⇒ void
This method returns an undefined value.
Add and start up a new RFlow::Connection.
253 254 255 256 |
# File 'lib/rflow/component/port.rb', line 253 def add_connection(key, connection) super connection.connect_input! if connected? end |
#connect! ⇒ void
This method returns an undefined value.
Connect all the input connections, once everything’s been set up.
244 245 246 247 |
# 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) ⇒ void
This method returns an undefined value.
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.
264 265 266 267 268 269 270 271 272 |
# 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 || callback.call self, key, connection, end end end end |