Class: Persona
- Inherits:
-
Object
- Object
- Persona
- Defined in:
- lib/alu0100987522/individuo.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#apellido ⇒ Object
readonly
Returns the value of attribute apellido.
-
#edad ⇒ Object
readonly
Returns the value of attribute edad.
-
#genero ⇒ Object
readonly
Returns the value of attribute genero.
-
#nombre ⇒ Object
readonly
Returns the value of attribute nombre.
Instance Method Summary collapse
-
#initialize(nombre, apellido, edad, genero) ⇒ Persona
constructor
A new instance of Persona.
- #to_s ⇒ Object
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
#apellido ⇒ Object (readonly)
Returns the value of attribute apellido.
3 4 5 |
# File 'lib/alu0100987522/individuo.rb', line 3 def apellido @apellido end |
#edad ⇒ Object (readonly)
Returns the value of attribute edad.
3 4 5 |
# File 'lib/alu0100987522/individuo.rb', line 3 def edad @edad end |
#genero ⇒ Object (readonly)
Returns the value of attribute genero.
3 4 5 |
# File 'lib/alu0100987522/individuo.rb', line 3 def genero @genero end |
#nombre ⇒ Object (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_s ⇒ Object
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 |