Class: Node
- Inherits:
-
Object
- Object
- Node
- Defined in:
- lib/priority-queue/benchmark/dijkstra.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#neighbours ⇒ Object
readonly
Returns the value of attribute neighbours.
Instance Method Summary collapse
-
#initialize(id) ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id) ⇒ Node
Returns a new instance of Node.
10 11 12 13 |
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 10 def initialize(id) @neighbours = [] @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 8 def id @id end |
#neighbours ⇒ Object (readonly)
Returns the value of attribute neighbours.
8 9 10 |
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 8 def neighbours @neighbours end |
Instance Method Details
#inspect ⇒ Object
15 16 17 |
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 15 def inspect to_s end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 19 def to_s "(#{@id})" end |