Actually make singleton_methods private

(Rubocop told me so and I trust the police)
This commit is contained in:
Daniel Schädler 2019-05-13 13:57:23 +02:00
parent 75a394540e
commit 0e916b3ff9
1 changed files with 32 additions and 30 deletions

View File

@ -101,14 +101,15 @@ class PlayoffStageService
match_below match_below
end end
class << self
private private
def self.find_companion_match(current_position, current_stage) def find_companion_match(current_position, current_stage)
companion_match_position = current_position.even? ? current_position + 1 : current_position - 1 companion_match_position = current_position.even? ? current_position + 1 : current_position - 1
current_stage.matches.find { |m| m.position == companion_match_position } current_stage.matches.find { |m| m.position == companion_match_position }
end end
def self.assign_correct_match_scores!(match_scores, winners) def assign_correct_match_scores!(match_scores, winners)
case match_scores.size case match_scores.size
when 0 when 0
# when 0 match_scores are already there we create both of them with the respective winner from above # when 0 match_scores are already there we create both of them with the respective winner from above
@ -131,8 +132,9 @@ class PlayoffStageService
match_scores match_scores
end end
def self.get_winners_of(companion_match, current_match) def get_winners_of(companion_match, current_match)
matches = [current_match, companion_match].sort_by(&:position) matches = [current_match, companion_match].sort_by(&:position)
matches.map(&:winner) matches.map(&:winner)
end end
end
end end