End of the day
authorNeil Smith <neil.github@njae.me.uk>
Mon, 26 Sep 2011 09:38:28 +0000 (10:38 +0100)
committerNeil Smith <neil.github@njae.me.uk>
Mon, 26 Sep 2011 09:38:28 +0000 (10:38 +0100)
lib/erd_handler/erd.rb
lib/erd_handler/link.rb
spec/erd_handler/erd_spec.rb

index a0c94e4d931a33e98295f4a48cd7bf59949d74d5..f7e246a0d3581a7c62c747f5575e7956b038d522 100644 (file)
@@ -20,4 +20,4 @@ module ErdHandler
       self
     end
   end
       self
     end
   end
-end
\ No newline at end of file
+end
index f8ebc193db3be7d84a2f6b99357b578f0dfcd08c..eec4341e50d67a74ef88c09944e94213303e5632 100644 (file)
@@ -9,7 +9,19 @@ module ErdHandler
     def read(link_element, vertices)
       self.id = link_element.attributes["id"].to_i
       self.mark = link_element.attributes["mark"].to_f
     def read(link_element, vertices)
       self.id = link_element.attributes["id"].to_i
       self.mark = link_element.attributes["mark"].to_f
-      
+      self.name = link_element.elements['moveableName'].attributes['name']
+ puts "vertices = #{vertices}"      
+      box1 = vertices.select {|v| v.id == link_element.elements['box1'].attributes['id']}[0]
+ puts "found box1: #{box1}"     
+      box2 = vertices.select {|v| v.id == link_element.elements['box2'].attributes['id']}[0]
+ puts "found box2: #{box2}"
+      self << box1 << box2
+      c1 = self.connections.find {|c| c.end == box1}
+      c1.blob = link_element.elements['box1EndAdornments'].attributes['blob']
+      c1.crowsfoot = link_element.elements['box1EndAdornments'].attributes['crowsfoot']
+      c2 = self.connections.find {|c| c.end == box2}
+      c2.blob = link_element.elements['box2EndAdornments'].attributes['blob']
+      c2.crowsfoot = link_element.elements['box2EndAdornments'].attributes['crowsfoot']
     end
   end
     end
   end
-end
\ No newline at end of file
+end
index 164a91eb3f170e8bd9c0948584df9f8d3b7231b1..12ef23972e4674b8580e2b03eb6cb40c69797243 100644 (file)
@@ -26,9 +26,12 @@ module ErdHandler
         erd.mark.should == 4.5
         erd.should have(2).vertices
         erd.should have(1).edges
         erd.mark.should == 4.5
         erd.should have(2).vertices
         erd.should have(1).edges
+        
+        erd.vertices[0].neighbours.should include(erd.vertices[1])
+        erd.vertices[1].neighbours.should include(erd.vertices[0])        
       end
       
       it "reads and creates a box with a self-loop"
     end # #initialize
   end
       end
       
       it "reads and creates a box with a self-loop"
     end # #initialize
   end
-end
\ No newline at end of file
+end