Class: Persona

Inherits:
Object
  • Object
show all
Defined in:
lib/alu0100987522/individuo.rb

Direct Known Subclasses

Paciente

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nombre, apellido, edad, genero) ⇒ Persona

Returns a new instance of Persona.



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

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

Instance Attribute Details

#apellidoObject (readonly)

Returns the value of attribute apellido.



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

def apellido
  @apellido
end

#edadObject (readonly)

Returns the value of attribute edad.



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

def edad
  @edad
end

#generoObject (readonly)

Returns the value of attribute genero.



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

def genero
  @genero
end

#nombreObject (readonly)

Returns the value of attribute nombre.



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

def nombre
  @nombre
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/alu0100987522/individuo.rb', line 12

def to_s
   return %Q(#{@nombre} #{@apellido} - Edad: #{@edad} años - Género: #{@genero}.)
end