Class: RFlow::Component::InputPort

Inherits:
HashPort show all
Defined in:
lib/rflow/component/port.rb

Instance Attribute Summary

Attributes inherited from HashPort

#name, #uuid

Attributes inherited from Port

#component, #connected

Instance Method Summary collapse

Methods inherited from HashPort

#[], #all_connections, #collect_messages, #connections_for, #direct_connect, #each, #initialize, #keys, #remove_connection, #send_message

Methods inherited from Port

#connected?, #initialize

Constructor Details

This class inherits a constructor from RFlow::Component::HashPort

Instance Method Details

#add_connection(key, connection) ⇒ Object



171
172
173
174
# File 'lib/rflow/component/port.rb', line 171

def add_connection(key, connection)
  super
  connection.connect_input! if connected?
end

#connect!Object



166
167
168
169
# File 'lib/rflow/component/port.rb', line 166

def connect!
  @connections_for.each {|key, conns| conns.each {|c| c.connect_input! } }
  @connected = true
end

#recv_callback=(callback) ⇒ Object



176
177
178
179
180
181
182
183
184
# File 'lib/rflow/component/port.rb', line 176

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