Class: Xipai::Arrangement::Team

Inherits:
Base
  • Object
show all
Defined in:
lib/xipai/arrangement/team.rb

Instance Attribute Summary

Attributes inherited from Base

#params

Instance Method Summary collapse

Methods inherited from Base

#__attributes__, #__require_attributes__, attributes, #dump_replay_yaml, #initialize, #method_missing, #method_missing_hook, require_attributes, #to_replay_data, #valid!

Constructor Details

This class inherits a constructor from Xipai::Arrangement::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Xipai::Arrangement::Base

Instance Method Details

#applyObject



13
14
15
16
17
18
19
20
# File 'lib/xipai/arrangement/team.rb', line 13

def apply
  _hashcode, _shuffled = Xipai::Core.scrumble!(
    key_words, hashcode, items, params
  ).tap {|me| break *[me[:hashcode], me[:shuffled]]}
  result_set = team(_shuffled, number_of_members)

  return Xipai::Result.new(mode, _hashcode, result_set, params)
end

#team(_items, _number_of_members) ⇒ Object



22
23
24
# File 'lib/xipai/arrangement/team.rb', line 22

def team(_items, _number_of_members)
  return _items.each_slice(_number_of_members).to_a
end