Class: Node
- Inherits:
-
Struct
- Object
- Struct
- Node
- Includes:
- Comparable
- Defined in:
- lib/exam/list.rb,
lib/exam/node.rb
Overview
Representación de un nodo que tendrá su valor, la dirección del siguiente nodo y la del anterior. Esta clase será usada posteriormente por la clase List.
Instance Attribute Summary collapse
-
#anterior ⇒ Object
Returns the value of attribute anterior.
-
#next ⇒ Object
Returns the value of attribute next.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Método que se ha de implementar al incluir el Mixin Comparable y con el que se hace la comparativa entre el valor del nodo y otro pasado por parámetro.
Instance Attribute Details
#anterior ⇒ Object
Returns the value of attribute anterior
5 6 7 |
# File 'lib/exam/node.rb', line 5 def anterior @anterior end |
#next ⇒ Object
Returns the value of attribute next
5 6 7 |
# File 'lib/exam/node.rb', line 5 def next @next end |
#value ⇒ Object
Returns the value of attribute value
5 6 7 |
# File 'lib/exam/node.rb', line 5 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
Método que se ha de implementar al incluir el Mixin Comparable y con el que se hace la comparativa entre el valor del nodo y otro pasado por parámetro
9 10 11 |
# File 'lib/exam/list.rb', line 9 def <=> (other) value <=> other.value end |