Class: Individuo
Direct Known Subclasses
Instance Attribute Summary collapse
-
#edad ⇒ Object
readonly
Returns the value of attribute edad.
-
#nombre ⇒ Object
readonly
Returns the value of attribute nombre.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(nombre, edad) ⇒ Individuo
constructor
A new instance of Individuo.
- #to_s ⇒ Object
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
#edad ⇒ Object (readonly)
Returns the value of attribute edad.
3 4 5 |
# File 'lib/Ein/individuo.rb', line 3 def edad @edad end |
#nombre ⇒ Object (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_s ⇒ Object
18 19 20 21 22 23 |
# File 'lib/Ein/individuo.rb', line 18 def to_s "#{@nombre}" end |