class Lista
Attributes
cabeza[R]
cola[R]
Public Class Methods
new()
click to toggle source
# File lib/alimento/lista.rb, line 10 def initialize() @cabeza,@cola = nil end
Public Instance Methods
each() { |value| ... }
click to toggle source
# File lib/alimento/lista.rb, line 14 def each aux = @cabeza while aux != @cola do yield aux.value aux = aux.next end yield aux.value end
pop_first()
click to toggle source
# File lib/alimento/lista.rb, line 40 def pop_first() @cabeza = @cabeza.next end
pop_last()
click to toggle source
# File lib/alimento/lista.rb, line 44 def pop_last() @cola = @cola.prev end
push(other)
click to toggle source
# File lib/alimento/lista.rb, line 23 def push(other) if @cabeza == nil @cabeza = other other.next = @cabeza other.prev = @cabeza @cola = other end if @cabeza != nil other.next = @cabeza other.prev = @cola @cola.next = other @cabeza.prev = other @cola = other end end