Class: Zelkova::Edge
Instance Attribute Summary collapse
-
#end_node ⇒ Object
readonly
Returns the value of attribute end_node.
-
#start_node ⇒ Object
readonly
Returns the value of attribute start_node.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(start_node, end_node, weight) ⇒ Edge
constructor
A new instance of Edge.
- #inspect ⇒ Object
Constructor Details
#initialize(start_node, end_node, weight) ⇒ Edge
Returns a new instance of Edge.
16 17 18 19 20 |
# File 'lib/zelkova/edge.rb', line 16 def initialize(start_node, end_node, weight) @start_node = T.let(start_node, Zelkova::Node) @end_node = T.let(end_node, Zelkova::Node) @weight = T.let(weight, Integer) end |
Instance Attribute Details
#end_node ⇒ Object (readonly)
Returns the value of attribute end_node.
11 12 13 |
# File 'lib/zelkova/edge.rb', line 11 def end_node @end_node end |
#start_node ⇒ Object (readonly)
Returns the value of attribute start_node.
9 10 11 |
# File 'lib/zelkova/edge.rb', line 9 def start_node @start_node end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
13 14 15 |
# File 'lib/zelkova/edge.rb', line 13 def weight @weight end |
Instance Method Details
#inspect ⇒ Object
23 24 25 |
# File 'lib/zelkova/edge.rb', line 23 def inspect "Start Word: #{self.start_node.word}, End Word: #{self.end_node.word}, Weight: #{weight}" end |