Class: Lista
- Inherits:
-
Object
- Object
- Lista
- Defined in:
- lib/menud/lista.rb
Instance Method Summary collapse
-
#elemento ⇒ Object
Just to define the element.
-
#extraer_elemento ⇒ Object
We extract a element from the simple linked list.
-
#initialize ⇒ Lista
constructor
We set to nil value the initial node.
-
#insertar_elemento(nodo) ⇒ Object
We insert a new element on the simple linked list.
Constructor Details
Instance Method Details
#elemento ⇒ Object
Just to define the element
34 35 36 37 |
# File 'lib/menud/lista.rb', line 34 def elemento @elemento end |
#extraer_elemento ⇒ Object
We extract a element from the simple linked list
51 52 53 54 55 56 |
# File 'lib/menud/lista.rb', line 51 def extraer_elemento aux = @elemento @elemento = @elemento.next aux.value end |
#insertar_elemento(nodo) ⇒ Object
We insert a new element on the simple linked list
40 41 42 43 44 45 46 47 |
# File 'lib/menud/lista.rb', line 40 def insertar_elemento(nodo) if @elemento != nil nodo.next = @elemento @elemento = nodo end end |