Class: WorkTogether::Generator
- Inherits:
-
Object
- Object
- WorkTogether::Generator
- Defined in:
- lib/work_together.rb
Instance Attribute Summary collapse
-
#batch_id ⇒ Object
Returns the value of attribute batch_id.
-
#client ⇒ Object
Returns the value of attribute client.
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#pair_maker ⇒ Object
Returns the value of attribute pair_maker.
Instance Method Summary collapse
- #generate_togetherness(options, quiet = nil) ⇒ Object
- #help ⇒ Object
-
#initialize(batch_id = nil) ⇒ Generator
constructor
A new instance of Generator.
- #make_batch ⇒ Object
- #make_batch_data ⇒ Object
- #make_groups(options, quiet = nil, students = nil) ⇒ Object
Constructor Details
Instance Attribute Details
#batch_id ⇒ Object
Returns the value of attribute batch_id.
13 14 15 |
# File 'lib/work_together.rb', line 13 def batch_id @batch_id end |
#client ⇒ Object
Returns the value of attribute client.
13 14 15 |
# File 'lib/work_together.rb', line 13 def client @client end |
#keys ⇒ Object
Returns the value of attribute keys.
13 14 15 |
# File 'lib/work_together.rb', line 13 def keys @keys end |
#pair_maker ⇒ Object
Returns the value of attribute pair_maker.
13 14 15 |
# File 'lib/work_together.rb', line 13 def pair_maker @pair_maker end |
Instance Method Details
#generate_togetherness(options, quiet = nil) ⇒ Object
21 22 23 24 |
# File 'lib/work_together.rb', line 21 def generate_togetherness(, quiet=nil) make_batch make_groups(, quiet) end |
#help ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/work_together.rb', line 60 def help puts "Available commands:" puts "work-together pairs --random batch-number generate pairs randomly" puts "work-together pairs --progress batch-number generate pairs grouped by similar progress" puts "work-together pairs --mindful batch-number generate pairs with one person who is more advanced, one person less advanced" puts "work-together tables --random batch-number generate tables randomly" puts "work-together tables --progress batch-number generate tables grouped by similar progress" puts "work-together tables --mindful batch-number generate tables with some people more advanced, some less" puts "work-together groups --num-of-groups batch-number genereate n number of groups" end |
#make_batch ⇒ Object
26 27 28 29 30 31 |
# File 'lib/work_together.rb', line 26 def make_batch configure_client student_data = get_and_parse_csv Student.generate_from_data(student_data) Student.all end |
#make_batch_data ⇒ Object
33 34 35 36 |
# File 'lib/work_together.rb', line 33 def make_batch_data configure_client get_and_parse_csv end |
#make_groups(options, quiet = nil, students = nil) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/work_together.rb', line 38 def make_groups(, quiet=nil, students=nil) students ||= Student.all flag = [1][2..-1] if .include?("pairs") pair_maker.public_send("make_pairs_#{flag}", students) elsif .include?("tables") pair_maker.public_send("make_tables_#{flag}", students) elsif .include?("groups") pair_maker.public_send("make_groups", flag, students) elsif .include?("--help") help else puts "Please enter a valid command. Type work-together --help for more." end if !quiet && Group.all.length > 0 Group.display_groups else Group.all end end |