X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=lib%2Fgraph%2Fedge.rb~;fp=lib%2Fgraph%2Fedge.rb~;h=0000000000000000000000000000000000000000;hb=d70d060196f0a62cbd3f5906e93cc1b2b31bc319;hp=c579a2f6cbf27188406c9121a900aae27c6353f4;hpb=0b3df692a2a00199692d72ede064821bc9bf5935;p=graph.njae.git diff --git a/lib/graph/edge.rb~ b/lib/graph/edge.rb~ deleted file mode 100644 index c579a2f..0000000 --- a/lib/graph/edge.rb~ +++ /dev/null @@ -1,33 +0,0 @@ -require 'ostruct' - -module Graph - class Edge < OpenStruct - def initialize - super - self.connections = [] - self - end - - def <<(other) - c = Connection.new - c.end = other - self.connections << c - self - end - - def vertices - self.connections.map {|c| c.end} - end - - def connection_at(vertex) - self.connections.select {|c| c.end.equal? vertex}.first - end - end - - class Connection < OpenStruct - def initialize - super - self - end - end -end