From: Neil Smith Date: Mon, 26 Sep 2011 09:38:28 +0000 (+0100) Subject: End of the day X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=54fb8d2f752d1ad35d11a03bb6e1443257a472c9;p=erd-marker.git End of the day --- diff --git a/lib/erd_handler/erd.rb b/lib/erd_handler/erd.rb index a0c94e4..f7e246a 100644 --- a/lib/erd_handler/erd.rb +++ b/lib/erd_handler/erd.rb @@ -20,4 +20,4 @@ module ErdHandler self end end -end \ No newline at end of file +end diff --git a/lib/erd_handler/link.rb b/lib/erd_handler/link.rb index f8ebc19..eec4341 100644 --- a/lib/erd_handler/link.rb +++ b/lib/erd_handler/link.rb @@ -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 - + 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 \ No newline at end of file +end diff --git a/spec/erd_handler/erd_spec.rb b/spec/erd_handler/erd_spec.rb index 164a91e..12ef239 100644 --- a/spec/erd_handler/erd_spec.rb +++ b/spec/erd_handler/erd_spec.rb @@ -26,9 +26,12 @@ module ErdHandler 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 \ No newline at end of file +end