plexus 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/plexus/adjacency_graph.rb +1 -1
- data/lib/plexus/arc.rb +2 -1
- data/lib/plexus/edge.rb +4 -2
- data/lib/plexus/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
@@ -110,7 +110,7 @@ module Plexus
|
|
110
110
|
n = u.number if u.class.include? ArcNumber and n.nil?
|
111
111
|
u, v, l = u.source, u.target, u.label if u.is_a? Plexus::Arc
|
112
112
|
|
113
|
-
return self if
|
113
|
+
return self if !@allow_loops && u == v
|
114
114
|
|
115
115
|
n = (@next_edge_number += 1) unless n if @parallel_edges
|
116
116
|
add_vertex!(u)
|
data/lib/plexus/arc.rb
CHANGED
@@ -13,7 +13,8 @@ module Plexus
|
|
13
13
|
|
14
14
|
# Ignore labels for equality.
|
15
15
|
def eql?(other)
|
16
|
-
|
16
|
+
same_class = (self.class.ancestors.include? other.class)
|
17
|
+
same_class && target == other.target && source == other.source
|
17
18
|
end
|
18
19
|
alias == eql?
|
19
20
|
|
data/lib/plexus/edge.rb
CHANGED
@@ -3,9 +3,11 @@ module Plexus
|
|
3
3
|
# undirected graphs. Edge[u,v] == Edge[v,u]
|
4
4
|
class Edge < Arc
|
5
5
|
|
6
|
-
#
|
6
|
+
# Edge equality allows for the swapping of source and target.
|
7
|
+
#
|
7
8
|
def eql?(other)
|
8
|
-
|
9
|
+
same_class = (self.class.ancestors.include? other.class)
|
10
|
+
super || (same_class && target == other.source && source == other.target)
|
9
11
|
end
|
10
12
|
alias == eql?
|
11
13
|
|
data/lib/plexus/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -48,11 +48,11 @@ module AncestryHelper
|
|
48
48
|
end
|
49
49
|
|
50
50
|
RSpec.configure do |config|
|
51
|
+
config.include AncestryHelper
|
51
52
|
# Remove this line if you don't want RSpec's should and should_not
|
52
53
|
# methods or matchers
|
53
54
|
require 'rspec/expectations'
|
54
55
|
config.include RSpec::Matchers
|
55
|
-
config.include AncestryHelper
|
56
56
|
|
57
57
|
# == Mock Framework
|
58
58
|
config.mock_with :rspec
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: plexus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bruce Williams
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-07-
|
14
|
+
date: 2011-07-10 00:00:00 +02:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|