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, #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



146
147
148
149
# File 'lib/rflow/component/port.rb', line 146

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

#connect!Object



141
142
143
144
# File 'lib/rflow/component/port.rb', line 141

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

#recv_callback=(callback) ⇒ Object



151
152
153
154
155
156
157
158
159
# File 'lib/rflow/component/port.rb', line 151

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