Class: Individuo

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/gema/persona.rb

Direct Known Subclasses

Paciente

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(persona, peso, talla) ⇒ Individuo

Returns a new instance of Individuo.



4
5
6
7
8
# File 'lib/gema/persona.rb', line 4

def initialize(persona,peso,talla)
	@persona=persona
	@peso=peso
	@talla=talla
end

Instance Attribute Details

#personaObject (readonly)

Returns the value of attribute persona.



3
4
5
# File 'lib/gema/persona.rb', line 3

def persona
  @persona
end

#pesoObject (readonly)

Returns the value of attribute peso.



3
4
5
# File 'lib/gema/persona.rb', line 3

def peso
  @peso
end

#tallaObject (readonly)

Returns the value of attribute talla.



3
4
5
# File 'lib/gema/persona.rb', line 3

def talla
  @talla
end

Instance Method Details

#<=>(other) ⇒ Object



12
13
14
15
# File 'lib/gema/persona.rb', line 12

def <=>(other)
  		return nil unless other.instance_of?Individuo
  		@peso <=> other.peso
end

#to_sObject



9
10
11
# File 'lib/gema/persona.rb', line 9

def to_s
	"#{@persona} #{@peso} #{@talla}"
end