Class: WorkTogether
- Inherits:
-
Object
- Object
- WorkTogether
- Defined in:
- lib/work_together.rb,
lib/work_together/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
-
#pair_maker ⇒ Object
Returns the value of attribute pair_maker.
-
#roster ⇒ Object
Returns the value of attribute roster.
-
#students ⇒ Object
Returns the value of attribute students.
Instance Method Summary collapse
- #display_tables ⇒ Object
- #generate_togetherness(options) ⇒ Object
- #help ⇒ Object
-
#initialize(path_to_csv = nil) ⇒ WorkTogether
constructor
A new instance of WorkTogether.
- #make_students ⇒ Object
Constructor Details
#initialize(path_to_csv = nil) ⇒ WorkTogether
Returns a new instance of WorkTogether.
11 12 13 14 |
# File 'lib/work_together.rb', line 11 def initialize(path_to_csv=nil) @roster = path_to_csv @pair_maker = PairMaker.new end |
Instance Attribute Details
#pair_maker ⇒ Object
Returns the value of attribute pair_maker.
9 10 11 |
# File 'lib/work_together.rb', line 9 def pair_maker @pair_maker end |
#roster ⇒ Object
Returns the value of attribute roster.
9 10 11 |
# File 'lib/work_together.rb', line 9 def roster @roster end |
#students ⇒ Object
Returns the value of attribute students.
9 10 11 |
# File 'lib/work_together.rb', line 9 def students @students end |
Instance Method Details
#display_tables ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/work_together.rb', line 32 def display_tables Table.all.each_with_index do |table, i| puts "Group #{i + 1}:" table.students.each do |student| puts student.name end puts "-------------------" end end |
#generate_togetherness(options) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/work_together.rb', line 16 def generate_togetherness() make_students flag = [1][2..-1] if .include?("pairs") pair_maker.public_send("make_pairs_#{flag}", self.students) display_tables elsif .include?("tables") pair_maker.public_send("make_tables_#{flag}", self.students) display_tables elsif .include?("--help") help else puts "Please enter a valid command. Type work-together --help for more." end end |
#help ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/work_together.rb', line 42 def help puts "Available commands:" puts "work-together pairs --random path/to/csv-roster generate pairs randomly" puts "work-together pairs --progress path/to/csv-roster generate pairs grouped by similar progress" puts "work-together pairs --mindful path/to/csv-roster generate pairs with one person who is more advanced, one person less advanced" puts "work-together tables --random path/to/csv-roster generate tables randomly" puts "work-together tables --random path/to/csv-roster generate tables grouped by similar progress" puts "work-together tables --random path/to/csv-roster generate tables with some people more advanced, some less" end |
#make_students ⇒ Object
52 53 54 55 |
# File 'lib/work_together.rb', line 52 def make_students Parser.parse_and_make_students(roster) @students = Student.all end |