Class: Individuo
- Inherits:
-
Object
- Object
- Individuo
- Includes:
- Comparable
- Defined in:
- lib/tdd/valor_nutricional.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#apellido ⇒ Object
readonly
Returns the value of attribute apellido.
-
#nombre ⇒ Object
readonly
Returns the value of attribute nombre.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(nombre, apellido) ⇒ Individuo
constructor
A new instance of Individuo.
- #to_s ⇒ Object
Constructor Details
#initialize(nombre, apellido) ⇒ Individuo
Returns a new instance of Individuo.
5 6 7 8 |
# File 'lib/tdd/valor_nutricional.rb', line 5 def initialize(nombre,apellido) @nombre = nombre @apellido = apellido end |
Instance Attribute Details
#apellido ⇒ Object (readonly)
Returns the value of attribute apellido.
3 4 5 |
# File 'lib/tdd/valor_nutricional.rb', line 3 def apellido @apellido end |
#nombre ⇒ Object (readonly)
Returns the value of attribute nombre.
3 4 5 |
# File 'lib/tdd/valor_nutricional.rb', line 3 def nombre @nombre end |
Instance Method Details
#<=>(other) ⇒ Object
14 15 16 17 |
# File 'lib/tdd/valor_nutricional.rb', line 14 def <=>(other) return nil unless other.instance_of?Individuo @nombre <=> other.nombre end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/tdd/valor_nutricional.rb', line 10 def to_s "#{@nombre} #{@apellido}" end |