Class: Contender::LinkedQueue::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/contender/linked_queue.rb

Overview

Definition of a node in the linked list

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element = nil) ⇒ Node

Returns a new instance of Node.



319
320
321
# File 'lib/contender/linked_queue.rb', line 319

def initialize(element = nil)
  @element = element
end

Instance Attribute Details

#elementObject

Returns:

  • (Object)


315
316
317
# File 'lib/contender/linked_queue.rb', line 315

def element
  @element
end

#nextNode

Returns:



317
318
319
# File 'lib/contender/linked_queue.rb', line 317

def next
  @next
end

Instance Method Details

#clear_elementObject



329
330
331
# File 'lib/contender/linked_queue.rb', line 329

def clear_element
  @element = nil
end

#clear_nextObject



333
334
335
# File 'lib/contender/linked_queue.rb', line 333

def clear_next
  @next = nil
end

#element!Object



323
324
325
326
327
# File 'lib/contender/linked_queue.rb', line 323

def element!
  @element.tap do
    @element = nil
  end
end