Class: WorkTogether
- Inherits:
-
Object
- Object
- WorkTogether
- Defined in:
- lib/work_together.rb,
lib/work_together/version.rb
Constant Summary collapse
- VERSION =
"0.5.0"
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.
-
#students ⇒ Object
Returns the value of attribute students.
Instance Method Summary collapse
- #generate_togetherness(options, quiet = nil) ⇒ Object
-
#initialize(batch_id) ⇒ WorkTogether
constructor
A new instance of WorkTogether.
- #make_batch ⇒ Object
- #make_groups(options, quiet) ⇒ Object
Constructor Details
#initialize(batch_id) ⇒ WorkTogether
Returns a new instance of WorkTogether.
14 15 16 17 |
# File 'lib/work_together.rb', line 14 def initialize(batch_id) @batch_id = batch_id @pair_maker = PairMaker.new end |
Instance Attribute Details
#batch_id ⇒ Object
Returns the value of attribute batch_id.
12 13 14 |
# File 'lib/work_together.rb', line 12 def batch_id @batch_id end |
#client ⇒ Object
Returns the value of attribute client.
12 13 14 |
# File 'lib/work_together.rb', line 12 def client @client end |
#keys ⇒ Object
Returns the value of attribute keys.
12 13 14 |
# File 'lib/work_together.rb', line 12 def keys @keys end |
#pair_maker ⇒ Object
Returns the value of attribute pair_maker.
12 13 14 |
# File 'lib/work_together.rb', line 12 def pair_maker @pair_maker end |
#students ⇒ Object
Returns the value of attribute students.
12 13 14 |
# File 'lib/work_together.rb', line 12 def students @students end |
Instance Method Details
#generate_togetherness(options, quiet = nil) ⇒ Object
20 21 22 23 |
# File 'lib/work_together.rb', line 20 def generate_togetherness(, quiet=nil) make_batch make_groups(, quiet=quiet) end |
#make_batch ⇒ Object
25 26 27 28 29 |
# File 'lib/work_together.rb', line 25 def make_batch configure_client get_and_parse_csv @students = Student.all end |
#make_groups(options, quiet) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/work_together.rb', line 31 def make_groups(, quiet) flag = [1][2..-1] if .include?("pairs") pair_maker.public_send("make_pairs_#{flag}", self.students) elsif .include?("tables") pair_maker.public_send("make_tables_#{flag}", self.students) elsif .include?("--help") help else puts "Please enter a valid command. Type work-together --help for more." end display_tables if !quiet && Table.all.length > 0 end |