Class: Rukawa::Dag::Edge
- Inherits:
-
Object
- Object
- Rukawa::Dag::Edge
- Defined in:
- lib/rukawa/dag.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
readonly
Returns the value of attribute cluster.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #==(edge) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(from, to, cluster = nil) ⇒ Edge
constructor
A new instance of Edge.
- #inspect ⇒ Object
Constructor Details
#initialize(from, to, cluster = nil) ⇒ Edge
Returns a new instance of Edge.
117 118 119 |
# File 'lib/rukawa/dag.rb', line 117 def initialize(from, to, cluster = nil) @from, @to, @cluster = from, to, cluster end |
Instance Attribute Details
#cluster ⇒ Object (readonly)
Returns the value of attribute cluster.
115 116 117 |
# File 'lib/rukawa/dag.rb', line 115 def cluster @cluster end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
115 116 117 |
# File 'lib/rukawa/dag.rb', line 115 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
115 116 117 |
# File 'lib/rukawa/dag.rb', line 115 def to @to end |
Instance Method Details
#==(edge) ⇒ Object Also known as: eql?
125 126 127 128 |
# File 'lib/rukawa/dag.rb', line 125 def ==(edge) return false unless edge.is_a?(Edge) from == edge.from && to == edge.to end |
#hash ⇒ Object
131 132 133 |
# File 'lib/rukawa/dag.rb', line 131 def hash [from, to].hash end |
#inspect ⇒ Object
121 122 123 |
# File 'lib/rukawa/dag.rb', line 121 def inspect "#{@from.name} -> #{@to.name}" end |