Class: DSA::LinkedList::Node
- Inherits:
-
Object
- Object
- DSA::LinkedList::Node
- Defined in:
- lib/dsa-ruby/linked_list.rb
Instance Attribute Summary collapse
-
#next ⇒ Object
Returns the value of attribute next.
-
#val ⇒ Object
Returns the value of attribute val.
Instance Method Summary collapse
-
#initialize(val = 0, nxt = nil) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(val = 0, nxt = nil) ⇒ Node
Returns a new instance of Node.
6 7 8 9 |
# File 'lib/dsa-ruby/linked_list.rb', line 6 def initialize(val = 0, nxt = nil) @val = val @next = nxt end |
Instance Attribute Details
#next ⇒ Object
Returns the value of attribute next.
4 5 6 |
# File 'lib/dsa-ruby/linked_list.rb', line 4 def next @next end |
#val ⇒ Object
Returns the value of attribute val.
4 5 6 |
# File 'lib/dsa-ruby/linked_list.rb', line 4 def val @val end |