Class: List

Inherits:
Object
  • Object
show all
Defined in:
lib/biblio/list.rb

Instance Method Summary collapse

Constructor Details

#initializeList

Returns a new instance of List.



7
8
9
10
# File 'lib/biblio/list.rb', line 7

def initialize ()
       
    @elemento = Node.new(nil)
end

Instance Method Details

#elementoObject



12
13
14
15
# File 'lib/biblio/list.rb', line 12

def elemento
    
    @elemento
end

#extraer_elementoObject



26
27
28
29
30
31
# File 'lib/biblio/list.rb', line 26

def extraer_elemento 
    
    aux = @elemento
    @elemento = @elemento.next
    aux.value
end

#insertar_elemento(node) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/biblio/list.rb', line 17

def insertar_elemento(node)
    
    if @elemento != nil
        
        node.next = @elemento
        @elemento = node
    end
end