Class: SportsManager::Algorithms::Ordering::MultipleMatchesParticipant

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_manager/algorithms/ordering/multiple_matches_participant.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tournament) ⇒ MultipleMatchesParticipant

Returns a new instance of MultipleMatchesParticipant.



13
14
15
# File 'lib/sports_manager/algorithms/ordering/multiple_matches_participant.rb', line 13

def initialize(tournament)
  @tournament = tournament
end

Instance Attribute Details

#tournamentObject (readonly)

Returns the value of attribute tournament.



7
8
9
# File 'lib/sports_manager/algorithms/ordering/multiple_matches_participant.rb', line 7

def tournament
  @tournament
end

Class Method Details

.for(dependency:, problem: nil) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



9
10
11
# File 'lib/sports_manager/algorithms/ordering/multiple_matches_participant.rb', line 9

def self.for(dependency:, problem: nil) # rubocop:disable Lint/UnusedMethodArgument
  new(dependency)
end

Instance Method Details

#call(variables) ⇒ Object



17
18
19
# File 'lib/sports_manager/algorithms/ordering/multiple_matches_participant.rb', line 17

def call(variables)
  variables.sort_by(&method(:sort))
end