Method: List#push
- Defined in:
- lib/nutrientes/list.rb
#push(nodo) ⇒ Object
Inserts a node at the beginning of the list
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/nutrientes/list.rb', line 54 def push(nodo) if @size == 0 then @head = nodo @tail = nodo else @tail.nodo[:next_] = nodo nodo.nodo[:prev_] = @tail @tail = nodo end @size += 1 end |