Method: Async::List#prepend

Defined in:
lib/async/list.rb

#prepend(node) ⇒ Object

Prepend a node to the start of the list.


69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/async/list.rb', line 69

def prepend(node)
	if node.head
		raise ArgumentError, "Node is already in a list!"
	end
	
	node.head = self
	@tail.head = node
	node.tail = @tail
	@tail = node
	
	return added(node)
end