Class: TeamSeeder

Inherits:
Object
  • Object
show all
Defined in:
lib/bracket_graph/team_seeder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(teams, size, shuffle: false) ⇒ TeamSeeder

Returns a new instance of TeamSeeder.



4
5
6
7
# File 'lib/bracket_graph/team_seeder.rb', line 4

def initialize teams, size, shuffle: false
  @teams = shuffle && teams.shuffle || teams.dup
  @size = size
end

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size.



2
3
4
# File 'lib/bracket_graph/team_seeder.rb', line 2

def size
  @size
end

Instance Method Details

#slotsObject



9
10
11
12
13
14
15
# File 'lib/bracket_graph/team_seeder.rb', line 9

def slots
  return @slots if @slots
  @slots = [true] * size
  seed_byes
  seed_teams
  @slots
end