Skip to content

Instantly share code, notes, and snippets.

@undecided
Created January 31, 2013 16:55
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 undecided/4684314 to your computer and use it in GitHub Desktop.
Save undecided/4684314 to your computer and use it in GitHub Desktop.
I asked Joey to fix my code. She refused, but she did write this for me #soProud
class Kitten
def initialize
set_colour
set_name
end
def set_colour
if rand(0..1) == 1
@colour = 'White'
else
@colour = 'Black'
end
end
def set_name
if @colour == 'Black'
@name = 'Sooty'
elsif @colour == 'White'
@name = 'Princess'
end
end
def meow
puts "#{@name} kitten says: Im a happy kitty! Meow!"
end
def tiger
puts "#{@name} kitten says: Rawr, I is a tiny tiger."
end
def noise
if rand(0..1) == 1
meow
else
tiger
end
end
end
Kitten.new.noise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment