Convert Services to Singleton
This commit is contained in:
parent
56e9c94b6f
commit
4e892fe3a2
|
|
@ -1,6 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
require 'singleton'
|
||||
|
||||
class GroupStageService
|
||||
include Singleton
|
||||
|
||||
def self.generate_group_stage(groups)
|
||||
raise 'Cannot generate group stage without groups' if groups.length.zero?
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
require 'singleton'
|
||||
|
||||
class MatchService
|
||||
include Singleton
|
||||
|
||||
# Generates all necessary matches from a list of teams
|
||||
#
|
||||
# @param teams [Array] the teams to generate matches with
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
require 'singleton'
|
||||
|
||||
class PlayoffStageService
|
||||
include Singleton
|
||||
|
||||
# Generates the playoff stage given the tournament
|
||||
#
|
||||
# @param teams [Array] The teams to generate the playoff stages with
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
require 'singleton'
|
||||
|
||||
class Utils
|
||||
include Singleton
|
||||
|
||||
# Calculates the previous power of 2 given a number
|
||||
#
|
||||
# @param number [Integer] the number to generate the previous power of 2 from
|
||||
|
|
|
|||
Loading…
Reference in New Issue