Class: RubyDataStructures::SinglyLinkedList::Element
- Inherits:
-
Object
- Object
- RubyDataStructures::SinglyLinkedList::Element
- Defined in:
- lib/RubyDataStructures/singly_linked_list/element.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#next ⇒ Object
Returns the value of attribute next.
Instance Method Summary collapse
-
#initialize(list, key) ⇒ Element
constructor
Initializes an Element of SinglyLinkedList Arguments: list => Instance of SinglyLinkedList to which the element belongs to key => Value to be stored in the element.
Constructor Details
#initialize(list, key) ⇒ Element
Initializes an Element of SinglyLinkedList Arguments: list => Instance of SinglyLinkedList to which the element belongs to key => Value to be stored in the element.
9 10 11 12 |
# File 'lib/RubyDataStructures/singly_linked_list/element.rb', line 9 def initialize(list, key) @list = list @key = key end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
2 3 4 |
# File 'lib/RubyDataStructures/singly_linked_list/element.rb', line 2 def key @key end |
#next ⇒ Object
Returns the value of attribute next.
3 4 5 |
# File 'lib/RubyDataStructures/singly_linked_list/element.rb', line 3 def next @next end |