Class: RFlow::Component::HashSubPort

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

Overview

Stateless class to help with a nicer API

Instance Method Summary collapse

Constructor Details

#initialize(hash_port, key) ⇒ HashSubPort

Returns a new instance of HashSubPort.



49
50
51
52
# File 'lib/rflow/component/port.rb', line 49

def initialize(hash_port, key)
  @hash_port = hash_port
  @key = key
end

Instance Method Details

#connectionsObject



58
59
60
# File 'lib/rflow/component/port.rb', line 58

def connections
  @hash_port.connections_for(@key)
end

#direct_connect(other_port) ⇒ Object



62
63
64
# File 'lib/rflow/component/port.rb', line 62

def direct_connect(other_port)
  @hash_port.direct_connect(@key, other_port)
end

#eachObject



66
67
68
# File 'lib/rflow/component/port.rb', line 66

def each
  connections.each {|connection| yield connection }
end

#send_message(message) ⇒ Object



54
55
56
# File 'lib/rflow/component/port.rb', line 54

def send_message(message)
  connections.each {|connection| connection.send_message(message) }
end