Class: Nodo
- Inherits:
-
Struct
- Object
- Struct
- Nodo
- Includes:
- Comparable
- Defined in:
- lib/exam/nodo.rb,
lib/exam/lista.rb,
lib/exam/lista.rb
Overview
Nodo como objeto comparable y ordenable (se mira el valor que contiene)
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#next ⇒ Object
Returns the value of attribute next.
-
#previus ⇒ Object
Returns the value of attribute previus.
-
#valor ⇒ Object
readonly
Returns the value of attribute valor.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(valor) ⇒ Nodo
constructor
Constructor.
Constructor Details
#initialize(valor) ⇒ Nodo
Constructor
9 10 11 12 13 |
# File 'lib/exam/nodo.rb', line 9 def initialize(valor) @valor = valor @id = object_id #identificador univoco @next = nil end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/exam/nodo.rb', line 5 def id @id end |
#next ⇒ Object
Returns the value of attribute next.
6 7 8 |
# File 'lib/exam/nodo.rb', line 6 def next @next end |
#previus ⇒ Object
Returns the value of attribute previus
5 6 7 |
# File 'lib/exam/lista.rb', line 5 def previus @previus end |
#valor ⇒ Object (readonly)
Returns the value of attribute valor.
5 6 7 |
# File 'lib/exam/nodo.rb', line 5 def valor @valor end |
#value ⇒ Object
Returns the value of attribute value
5 6 7 |
# File 'lib/exam/lista.rb', line 5 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
10 11 12 |
# File 'lib/exam/lista.rb', line 10 def <=> (other) value <=> other.value end |