Skip to content

Instantly share code, notes, and snippets.

@codesword
Created June 5, 2016 12:13
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 codesword/d7f9901fa36ddbfe2620b462571f6bf0 to your computer and use it in GitHub Desktop.
Save codesword/d7f9901fa36ddbfe2620b462571f6bf0 to your computer and use it in GitHub Desktop.
class TrainingTeam
def train_new_fellow(name)
# Trains all new fellow
end
def training_period(fellow_name)
# Returns the period the fellow has been in training
end
end
class Director
def initialize
@traing_team = TrainingTeam.new
end
def method_missing(method, *args)
if /train.*/ ~= method
@training_team.send(method, *args)
else
super
end
end
end
director_of_training = Director.new
director_of_training.train_new_fellow("Aboki") # => trains aboki for six months
director_of_training.training_period("Aboki") # => returns the period `Aboki` has been in training
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment