Skip to content

Instantly share code, notes, and snippets.

@tefanga
Last active February 13, 2018 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tefanga/1925b023cef3ea8093ebb1b9a354d67e to your computer and use it in GitHub Desktop.
Save tefanga/1925b023cef3ea8093ebb1b9a354d67e to your computer and use it in GitHub Desktop.
fito y abuela
# Instructions: Declare an objet "AbuelaClotilde" (grandma name) -> Done..
# that understand a messeage... "alimentar_nieto" (feed_grandson)-> Done...
# and make him eat("comer") twice, first with 2000 calories then with 1000 calories -> Done...
# grandma("AbuelaClotilde") has to have a setter "nieto=(un_nieto)" that lets you configure her grandson("Fito") -> Done..
# AbuelaClotilde grandmother of Fito
# Fito = grandson of AbuelaClotilde
# @felicidad = happiness value
# @peso = weigth
# comer = eat
# calorias = calories
# error messege : AbuelaClotilde should not initialize by default her grandson
# expected Exception but nothing was raised
module Fito
@felicidad = 100
def self.comer(calorias)
@peso += calorias * 0.001
end
def self.felicidad
@felicidad
end
end
module AbuelaClotilde
@nieto =
def self.alimentar_nieto
Fito.comer(3000)
end
def self.nieto=(un_nieto)
@nieto = un_nieto
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment