Class: RFlow::Component::HashSubPort
- Inherits:
-
Object
- Object
- RFlow::Component::HashSubPort
- Defined in:
- lib/rflow/component/port.rb
Overview
Represents a keyed subport on a RFlow::Component - that is, an input or output port that has been subscripted with a port name for subdividing the messages being received or output.
Instance Method Summary collapse
-
#connections ⇒ Array<Connection>
Retrieve all the connections for this subport.
-
#direct_connect(other_port) ⇒ void
Directly connect this subport to another port.
-
#each ⇒ Array<Connection>
Enumerate the connections to this subport, yielding each.
-
#initialize(hash_port, key) ⇒ HashSubPort
constructor
A new instance of HashSubPort.
-
#send_message(message) ⇒ void
Send a Message down all the connections to this subport.
Constructor Details
#initialize(hash_port, key) ⇒ HashSubPort
Returns a new instance of HashSubPort.
75 76 77 78 |
# File 'lib/rflow/component/port.rb', line 75 def initialize(hash_port, key) @hash_port = hash_port @key = key end |
Instance Method Details
#connections ⇒ Array<Connection>
Retrieve all the connections for this subport.
89 90 91 |
# File 'lib/rflow/component/port.rb', line 89 def connections @hash_port.connections_for(@key) end |
#direct_connect(other_port) ⇒ void
This method returns an undefined value.
Directly connect this subport to another port.
96 97 98 |
# File 'lib/rflow/component/port.rb', line 96 def direct_connect(other_port) @hash_port.direct_connect(@key, other_port) end |
#each ⇒ Array<Connection>
Enumerate the connections to this subport, yielding each.
102 103 104 |
# File 'lib/rflow/component/port.rb', line 102 def each connections.each {|connection| yield connection } end |
#send_message(message) ⇒ void
This method returns an undefined value.
Send a Message down all the connections to this subport.
83 84 85 |
# File 'lib/rflow/component/port.rb', line 83 def () connections.each {|connection| connection.() } end |