Last active
May 2, 2016 20:39
-
-
Save garrettgsb/731158f501c0de2842c2c15ca87c546b to your computer and use it in GitHub Desktop.
This file contains 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
require 'pry-nav' | |
module Can_fly | |
def initialize | |
@flight = "Hell yeah" | |
end | |
def can_fly? | |
true | |
end | |
def fly_now | |
"I'm a #{self.name}, I can fly!" | |
end | |
end #Can_fly | |
class Animal | |
#Animal | |
attr_reader :eyes, :mouth, :limbs, :name | |
def initialize | |
@eyes = 2 | |
@mouth = 1 | |
@limbs = 4 | |
@name = "Some kind of animal" | |
end #initialize | |
end #Animal | |
class Mammal < Animal | |
#Mammal | |
attr_reader :name | |
def initialize | |
super | |
@name = "Mammal" | |
end #initialize | |
def warm_blooded? | |
true | |
end #warm_blooded? | |
def hairy? | |
true | |
end #hairy | |
end #Mammal | |
class Amphibian < Animal | |
#Amphibian | |
def initialize | |
super | |
@name = "Amphibian" | |
end #initialize | |
def warm_blooded? | |
false | |
end #warm_blooded | |
end #amphibian | |
class Primate < Mammal | |
attr_reader :name, :eyes, :limbs, :mouth, :num_legs | |
def initialize | |
super | |
@num_legs = 2 | |
@name = "Primate" | |
end #initialize | |
end #Primate | |
class Frog < Amphibian | |
#Frog | |
def initialize | |
super | |
@tongue = long | |
@name = "Frog" | |
end #initialize | |
end #frog | |
class Bat < Mammal | |
#Bat | |
include Can_fly | |
def initialize | |
super | |
@name = "Bat" | |
end #initialize | |
end #Bat | |
class Bird < Animal | |
#Bird | |
include Can_fly | |
attr_reader :eyes | |
def initialize | |
super | |
end #initialize | |
end #Bird | |
class Parrot < Bird | |
#Parrot | |
def initialize | |
super | |
end # initialize | |
end #Parrot | |
class Chimpanzee < Primate | |
#Chimpanzee | |
def initialize | |
super | |
end | |
def good_at_chess? | |
"Kind of." | |
end #good_at_chess | |
end #Chimpanzee | |
binding.pry | |
puts "kthxbye" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment