class Construqt::Cables

Public Class Methods

new(region) click to toggle source
# File lib/construqt/cables.rb, line 6
def initialize(region)
  @region = region
  @cables = {}
end

Public Instance Methods

add(iface_left, iface_right) click to toggle source
# File lib/construqt/cables.rb, line 35
def add(iface_left, iface_right)
  #    throw "left should be a iface #{iface_left.class.name}" unless iface_left.kind_of?(Construqt::Flavour::InterfaceDelegate)
  #    throw "right should be a iface #{iface_right.class.name}" unless iface_right.kind_of?(Construqt::Flavour::InterfaceDelegate)
  throw "left has a cable #{iface_left.cable}" if iface_left.cable
  throw "right has a cable #{iface_right.cable}" if iface_right.cable
  cable = Cable.new(iface_left, iface_right)
  throw "cable exists #{iface_left.cable}=#{iface_right.cable}" if @cables[cable.key]
  iface_left.cable = DirectedCable.new(cable, iface_right)
  iface_right.cable = DirectedCable.new(cable, iface_left)
  cable
end
region() click to toggle source
# File lib/construqt/cables.rb, line 11
def region
  @region
end