Class: Cheep::Connector
- Inherits:
-
Object
- Object
- Cheep::Connector
- Defined in:
- lib/connector.rb
Instance Attribute Summary collapse
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
Instance Method Summary collapse
-
#initialize(objects) ⇒ Connector
constructor
A new instance of Connector.
- #resolve_connections ⇒ Object
Constructor Details
#initialize(objects) ⇒ Connector
Returns a new instance of Connector.
4 5 6 |
# File 'lib/connector.rb', line 4 def initialize(objects) @objects = objects end |
Instance Attribute Details
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
2 3 4 |
# File 'lib/connector.rb', line 2 def objects @objects end |
Instance Method Details
#resolve_connections ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/connector.rb', line 8 def resolve_connections objects.each_with_object([]) do |obj, patch| obj.ins.each.with_index do |sender_or_senders, sender_input| if sender_or_senders.class == Array sender_or_senders.each do |sender| patch << connection(sender, obj, sender_input) end else patch << connection(sender_or_senders, obj, sender_input) end end end end |