Method: BracketGraph::Graph#seed
- Defined in:
- lib/bracket_graph/graph.rb
#seed(teams, shuffle: false) ⇒ Object
Fills the starting seats with the given ‘teams`
37 38 39 40 41 42 43 |
# File 'lib/bracket_graph/graph.rb', line 37 def seed teams, shuffle: false raise ArgumentError, "Only a maximum of #{size} teams is allowed" if teams.size > size slots = TeamSeeder.new(teams, size, shuffle: shuffle).slots starting_seats.sort_by(&:position).each do |seat| seat.payload = slots.shift end end |