tangle 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcae5a69389e6074f55eb085be956255e8521a1e5ed639f11cfbf9ddfa127caa
4
- data.tar.gz: 8be2323898911d92cc80d72796d709f38bb22dd8695529983ff587409d7c18b4
3
+ metadata.gz: 49f9618a6db24308eea9b672789ec0cb9a75ec124050cc5b748340bbc19ccdea
4
+ data.tar.gz: bb5aa5bf4b8e80942c7b2f1871529ef39a2a871ded60a01fb4acf23a288bca41
5
5
  SHA512:
6
- metadata.gz: 7b08fd566dfe1dc2b0e00133aabcc682f8fe846e123753116b44347522d96017934fa2a86f3aa756e59b8811018879e1356d25e1978ae67379aeeaefa0430731
7
- data.tar.gz: 9b5828084f4737d7d16f01d729db25fbe2f040a1c099fed77d3045293af149a73e77eee4ed716e914f29656537e3715c4fb326992b3ac6a406a44b32369323bd
6
+ metadata.gz: 47dddb4a4fa185863f69e06b63526eaa197d4f6bbdd7c5185199f6890eaa10f5799d9137868e7632bf6b1e8fd74c79fea3a066d728ebf0270f91914cd9f81254
7
+ data.tar.gz: 2c423486fb396bd060acb919fe00ac4459b7119a0fe08790549300560e39ea8831fb6df792dc5006d9733b085d9eb0ef9d1b957645aaa21cf4b0acfab2dc85a6
@@ -11,7 +11,7 @@ module Tangle
11
11
 
12
12
  def validate_edge
13
13
  super
14
- raise CyclicError if @parent.ancestor?(@child) &&
14
+ raise CyclicError if @parent.ancestor?(@child) ||
15
15
  @child.descendant?(@parent)
16
16
  end
17
17
  end
@@ -40,7 +40,7 @@ module Tangle
40
40
  end
41
41
 
42
42
  def ancestor?(other)
43
- connected?(other, test_method: :parent?)
43
+ other == self || parents.any? { |parent| parent.ancestor?(other) }
44
44
  end
45
45
 
46
46
  def child_edges
@@ -56,7 +56,7 @@ module Tangle
56
56
  end
57
57
 
58
58
  def descendant?(other)
59
- connected?(other, test_method: :child?)
59
+ other == self || children.any? { |child| child.descendant?(other) }
60
60
  end
61
61
  end
62
62
  end
@@ -53,20 +53,20 @@ module Tangle
53
53
  # Two vertices are connected if there is a path between them,
54
54
  # and a vertex is connected to itself.
55
55
  #
56
- def connected?(other, test_method: :adjacent?)
56
+ def connected?(other)
57
57
  raise GraphError unless @graph == other.graph
58
58
  return true if self == other
59
59
 
60
- connected_excluding?(other, test_method, Set[self])
60
+ connected_excluding?(other, Set[self])
61
61
  end
62
62
 
63
63
  protected
64
64
 
65
- def connected_excluding?(other, test_method, history)
66
- return true if send(test_method, other)
65
+ def connected_excluding?(other, history)
66
+ return true if other.adjacent?(self)
67
67
 
68
68
  (neighbours - history).any? do |vertex|
69
- vertex.connected_excluding?(other, test_method, history << self)
69
+ vertex.connected_excluding?(other, history << self)
70
70
  end
71
71
  end
72
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tangle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Calle Englund