Class: Link
- Inherits:
-
Object
- Object
- Link
- Defined in:
- lib/simms_structures/linked_list.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#next ⇒ Object
Returns the value of attribute next.
-
#prev ⇒ Object
Returns the value of attribute prev.
-
#val ⇒ Object
Returns the value of attribute val.
Instance Method Summary collapse
-
#initialize(key = nil, val = nil) ⇒ Link
constructor
A new instance of Link.
- #to_s ⇒ Object
Constructor Details
#initialize(key = nil, val = nil) ⇒ Link
Returns a new instance of Link.
4 5 6 7 8 9 |
# File 'lib/simms_structures/linked_list.rb', line 4 def initialize(key = nil, val = nil) @key = key @val = val @next = nil @prev = nil end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
2 3 4 |
# File 'lib/simms_structures/linked_list.rb', line 2 def key @key end |
#next ⇒ Object
Returns the value of attribute next.
2 3 4 |
# File 'lib/simms_structures/linked_list.rb', line 2 def next @next end |
#prev ⇒ Object
Returns the value of attribute prev.
2 3 4 |
# File 'lib/simms_structures/linked_list.rb', line 2 def prev @prev end |
#val ⇒ Object
Returns the value of attribute val.
2 3 4 |
# File 'lib/simms_structures/linked_list.rb', line 2 def val @val end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/simms_structures/linked_list.rb', line 11 def to_s "#{@key}: #{@val}" end |