Last active
December 13, 2015 22:29
-
-
Save yeehaa123/4984737 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 Session | |
attr_accessor :number, :name, :date | |
def initialize(number, name) | |
@number = number | |
@name = name | |
@date = session_date(number) | |
end | |
def session_date(number) | |
dates = %w[02032013 09032013 16032013 23032013 30032013] | |
return dates[number + 3] | |
end | |
end | |
class Course | |
def initialize(course_name) | |
@course_name = course_name | |
names = %w[Dan Ted Phil Steve Hank] | |
@sessions = [] | |
@participants = names.each { |name| Participant.new(name) } | |
end | |
def change_preference(options) | |
participant = @participants.where(name: options[:name]) | |
participant[:number] - options[:number] | |
end | |
end | |
Class Participant | |
attr_accessor: preference | |
def initialize(name, preference = nil, favorite_color) | |
@name = name | |
@preference = preference | |
@favorite_color = change_color(favorite_color) | |
end | |
def change_color(favorite_color) | |
return "black" | |
puts "tralalallalalalalalalalla" | |
end | |
end | |
course = Course.new("Arts, Science, and Technology") | |
course.change_preference({name: "Daan", 7]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment