Skip to content

Instantly share code, notes, and snippets.

@dannysmith
Created May 13, 2010 15:38
Show Gist options
  • Save dannysmith/399963 to your computer and use it in GitHub Desktop.
Save dannysmith/399963 to your computer and use it in GitHub Desktop.
class Person
attr_accessor :name, :height, :hair_color, :fatness
def initialize(name, height, hair, fatness)
self.name = name.capitalize
self.height = height.to_f
self.hair_color = hair.capitalize
self.fatness = fatness
end
def fit?
return true if (height > 5 && fatness == false && hair_color == "blonde")
return false
end
def make_thin
self.fatness = false
end
def dye_hair(colour)
self.hair_color = colour
end
def describe
"#{name} is #{height} tall, has #{hair_color} hair and #{fatness ? "is" : "is not"} fat."
end
end
class Baby < Person
attr_accessor :smellyness
def initialize(name, smellyness, fatness)
self.name = name.capitalize
self.height = 1
self.hair_color = "None"
self.fatness = fatness
self.smellyness = smellyness
end
def fit?
return "It's a fucking baby mate"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment