class RFlow::Component::HashSubPort

Represents a keyed subport on a {Component} - that is, an input or output port that has been subscripted with a port name for subdividing the messages being received or output.

Public Class Methods

new(hash_port, key) click to toggle source

@param hash_port [HashPort] the port to which this subport belongs @param key [String] the key subscript

# File lib/rflow/component/port.rb, line 75
def initialize(hash_port, key)
  @hash_port = hash_port
  @key = key
end

Public Instance Methods

connections() click to toggle source

Retrieve all the connections for this subport. @return [Array<Connection>]

# File lib/rflow/component/port.rb, line 89
def connections
  @hash_port.connections_for(@key)
end
direct_connect(other_port) click to toggle source

Directly connect this subport to another port. @param other_port [Port] the other port to connect to @return [void]

# File lib/rflow/component/port.rb, line 96
def direct_connect(other_port)
  @hash_port.direct_connect(@key, other_port)
end
each() { |connection| ... } click to toggle source

Enumerate the connections to this subport, +yield+ing each. @return [Array<Connection>]

# File lib/rflow/component/port.rb, line 102
def each
  connections.each {|connection| yield connection }
end
send_message(message) click to toggle source

Send a {Message} down all the connections to this subport. @param message [Message] @return [void]

# File lib/rflow/component/port.rb, line 83
def send_message(message)
  connections.each {|connection| connection.send_message(message) }
end