Class: DSA::LinkedList::DoublyNode

Inherits:
Object
  • Object
show all
Defined in:
lib/dsa-ruby/linked_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val = 0, nxt = nil, prev = nil) ⇒ DoublyNode

Returns a new instance of DoublyNode.



15
16
17
18
19
# File 'lib/dsa-ruby/linked_list.rb', line 15

def initialize(val = 0, nxt = nil, prev = nil)
  @val = val
  @next = nxt
  @prev = prev
end

Instance Attribute Details

#nextObject

Returns the value of attribute next.



13
14
15
# File 'lib/dsa-ruby/linked_list.rb', line 13

def next
  @next
end

#prevObject

Returns the value of attribute prev.



13
14
15
# File 'lib/dsa-ruby/linked_list.rb', line 13

def prev
  @prev
end

#valObject

Returns the value of attribute val.



13
14
15
# File 'lib/dsa-ruby/linked_list.rb', line 13

def val
  @val
end