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