X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=lib%2Fgraph.njae%2Fgraph.rb;h=e08a1ad8544d12aec4cacf3a095ca5e1e5df6aea;hb=5afeed673400a0d1e2c1c0d6b6f286f65723f405;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