Last active
August 29, 2015 14:04
-
-
Save elricstorm/518ef2e3f9632ca2560f 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
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