Skip to content

Instantly share code, notes, and snippets.

@elricstorm
Last active August 29, 2015 14:04
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 elricstorm/518ef2e3f9632ca2560f to your computer and use it in GitHub Desktop.
Save elricstorm/518ef2e3f9632ca2560f to your computer and use it in GitHub Desktop.
class Person
def look_around
puts "looks around carefully."
end
def witness_transformation
puts "Suddenly, #{@name} transforms into a #{$gender} named #{@new_name} right before your eyes!"
end
end
class Gender < Person
def initialize(gender)
@@gender = gender
end
def what?
puts "a tall #{@@gender},"
end
def begins_to_morph
@@gender == "female" ? $gender = "male" : $gender = "female"
end
end
class Name < Gender
def initialize(name)
@name = name
@new_name = ""
end
def change_name_to(name)
@new_name = name
end
def is_named_like_a(something)
is = Gender.new(something)
puts "#{@name}, "
is.what?
end
end
thing = Name.new('Jane')
thing.is_named_like_a('female')
thing.look_around
thing.begins_to_morph
thing.change_name_to('Jim')
thing.witness_transformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment