Created
October 1, 2012 16:02
-
-
Save superacidjax/3812700 to your computer and use it in GitHub Desktop.
Dogs and Modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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