Class: Individuo

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/Ein/individuo.rb

Direct Known Subclasses

Paciente

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nombre, edad) ⇒ Individuo

Returns a new instance of Individuo.



5
6
7
8
9
# File 'lib/Ein/individuo.rb', line 5

def initialize(nombre, edad)
   
   @nombre = nombre
   @edad = edad
end

Instance Attribute Details

#edadObject (readonly)

Returns the value of attribute edad.



3
4
5
# File 'lib/Ein/individuo.rb', line 3

def edad
  @edad
end

#nombreObject (readonly)

Returns the value of attribute nombre.



3
4
5
# File 'lib/Ein/individuo.rb', line 3

def nombre
  @nombre
end

Instance Method Details

#<=>(other) ⇒ Object



11
12
13
14
15
16
# File 'lib/Ein/individuo.rb', line 11

def <=> (other)

    return nil unless other.instance_of?Individuo
    edad <=> other.edad

end

#to_sObject



18
19
20
21
22
23
# File 'lib/Ein/individuo.rb', line 18

def to_s

    "#{@nombre}"


end