Class: CyclicLink
- Inherits:
-
Object
- Object
- CyclicLink
- Defined in:
- lib/cpp_dependency_graph/cyclic_link.rb
Overview
A special class designed to be used as a key in a hash
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(nodeA, nodeB) ⇒ CyclicLink
constructor
A new instance of CyclicLink.
- #nodeA ⇒ Object
- #nodeB ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(nodeA, nodeB) ⇒ CyclicLink
Returns a new instance of CyclicLink.
5 6 7 8 |
# File 'lib/cpp_dependency_graph/cyclic_link.rb', line 5 def initialize(nodeA, nodeB) @nodeA = nodeA @nodeB = nodeB end |
Instance Method Details
#eql?(other) ⇒ Boolean
18 19 20 21 |
# File 'lib/cpp_dependency_graph/cyclic_link.rb', line 18 def eql?(other) (@nodeA == other.nodeA && @nodeB == other.nodeB) || (@nodeA == other.nodeB && @nodeB == other.nodeA) end |
#hash ⇒ Object
23 24 25 |
# File 'lib/cpp_dependency_graph/cyclic_link.rb', line 23 def hash [@nodeA, @nodeB].to_set.hash end |
#nodeA ⇒ Object
10 11 12 |
# File 'lib/cpp_dependency_graph/cyclic_link.rb', line 10 def nodeA @nodeA end |
#nodeB ⇒ Object
14 15 16 |
# File 'lib/cpp_dependency_graph/cyclic_link.rb', line 14 def nodeB @nodeB end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/cpp_dependency_graph/cyclic_link.rb', line 27 def to_s "#{nodeA} <-> #{nodeB}" end |