Class: DDQL::LinkedList::Node
- Inherits:
-
Object
- Object
- DDQL::LinkedList::Node
- Defined in:
- lib/ddql/linked_list.rb
Instance Attribute Summary collapse
-
#next ⇒ Object
Returns the value of attribute next.
-
#previous ⇒ Object
Returns the value of attribute previous.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, next_node: nil, previous_node: nil) ⇒ Node
constructor
A new instance of Node.
- #to_s ⇒ Object
Constructor Details
#initialize(value, next_node: nil, previous_node: nil) ⇒ Node
Returns a new instance of Node.
12 13 14 15 16 |
# File 'lib/ddql/linked_list.rb', line 12 def initialize(value, next_node: nil, previous_node: nil) @next = next_node @previous = previous_node @value = value end |
Instance Attribute Details
#next ⇒ Object
Returns the value of attribute next.
9 10 11 |
# File 'lib/ddql/linked_list.rb', line 9 def next @next end |
#previous ⇒ Object
Returns the value of attribute previous.
9 10 11 |
# File 'lib/ddql/linked_list.rb', line 9 def previous @previous end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/ddql/linked_list.rb', line 10 def value @value end |
Instance Method Details
#to_s ⇒ Object
18 19 20 |
# File 'lib/ddql/linked_list.rb', line 18 def to_s "Node[#{@value}]" end |