X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fgraph.njae%2Fgraph.rb;h=e08a1ad8544d12aec4cacf3a095ca5e1e5df6aea;hb=5d0d968af54bf21b892c25074a9ca452604bb210;hp=1da5297d1f74861b24ce417dc2ac6c0ff3181111;hpb=c34def40508c16cfc815fa02c8743d071491af7b;p=graph.njae.git diff --git a/lib/graph.njae/graph.rb b/lib/graph.njae/graph.rb index 1da5297..e08a1ad 100644 --- a/lib/graph.njae/graph.rb +++ b/lib/graph.njae/graph.rb @@ -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