Class: Node

Inherits:
Struct
  • Object
show all
Includes:
Comparable
Defined in:
lib/DobLinkedList.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nextObject

Returns the value of attribute next

Returns:

  • (Object)

    the current value of next



6
7
8
# File 'lib/DobLinkedList.rb', line 6

def next
  @next
end

#prevObject

Returns the value of attribute prev

Returns:

  • (Object)

    the current value of prev



6
7
8
# File 'lib/DobLinkedList.rb', line 6

def prev
  @prev
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



6
7
8
# File 'lib/DobLinkedList.rb', line 6

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



9
10
11
12
13
# File 'lib/DobLinkedList.rb', line 9

def <=>(other)
    return nil unless other.instance_of?Node
    
    value <=> other.value 
end

#to_sObject



15
16
17
# File 'lib/DobLinkedList.rb', line 15

def to_s
    "[ |#{value}| ]"
end