Move self methods into self block
This commit is contained in:
parent
b40f5eaff2
commit
5900328944
|
|
@ -1,7 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class GroupStageService
|
||||
def self.generate_group_stage(groups)
|
||||
class << self
|
||||
def generate_group_stage(groups)
|
||||
raise 'Cannot generate group stage without groups' if groups.length.zero?
|
||||
|
||||
# raise an error if the average group size is not a whole number
|
||||
|
|
@ -11,11 +12,11 @@ class GroupStageService
|
|||
Stage.new level: -1, groups: groups
|
||||
end
|
||||
|
||||
def self.get_group_object_from(team_array)
|
||||
def get_group_object_from(team_array)
|
||||
Group.new matches: generate_all_matches_between(team_array)
|
||||
end
|
||||
|
||||
def self.generate_all_matches_between(teams)
|
||||
def generate_all_matches_between(teams)
|
||||
matches = []
|
||||
teams.combination(2).to_a # = matchups
|
||||
.each_with_index do |matchup, i|
|
||||
|
|
@ -30,3 +31,4 @@ class GroupStageService
|
|||
matches
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue