Skip to content

Instantly share code, notes, and snippets.

@superacidjax
Created October 1, 2012 16:02
Show Gist options
  • Select an option

  • Save superacidjax/3812700 to your computer and use it in GitHub Desktop.

Select an option

Save superacidjax/3812700 to your computer and use it in GitHub Desktop.
Dogs and Modules
Class Animal
def breathe
# code to take a breath.
end
end
Module Nutrition
def absorb_nutrients
#code for absorbing nutrients
end
end
Class Dog < Animal # this means the Dog class inherits from Animal Class
def eat
move_jaw
generate_saliva
swallow_food
Nutrition::absorb_nutrients
end
def bark
if current_dog == "big dog"
if current_dog.breed.hound?
# code for loud howling noise
else
#code for make loud, booming noise
end
elsif current_dog == "small dog"
if current.dog hound?
# code to make a small howling noise
breathe
else
99.times do
# code for shrill yipping noise
end
breathe
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment