Handles subclasses of Vertex and Edge
[graph.njae.git] / lib / graph.njae / graph.rb
index 1da5297d1f74861b24ce417dc2ac6c0ff3181111..e08a1ad8544d12aec4cacf3a095ca5e1e5df6aea 100644 (file)
@@ -16,9 +16,9 @@ module GraphNjae
     
     # Add a Vertex or Edge to the graph.
     def <<(other)
-      if other.class == Vertex
+      if other.class.ancestors.include? Vertex
         self.vertices << other
-      elsif
+      elsif other.class.ancestors.include? Edge
         self.edges << other
       end
       self