Class: Construqt::Cables

Inherits:
Object
  • Object
show all
Defined in:
lib/construqt/cables.rb

Defined Under Namespace

Classes: Cable, DirectedCable

Instance Method Summary collapse

Constructor Details

#initialize(region) ⇒ Cables

Returns a new instance of Cables.



6
7
8
9
# File 'lib/construqt/cables.rb', line 6

def initialize(region)
  @region = region
  @cables = {}
end

Instance Method Details

#add(iface_left, iface_right) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# 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

#regionObject



11
12
13
# File 'lib/construqt/cables.rb', line 11

def region
  @region
end