Class: Ranker::Strategies::StandardCompetition
- Defined in:
- lib/ranker/strategies/standard_competition.rb
Overview
Ranks rankables according to: en.wikipedia.org/wiki/Ranking#Standard_competition_ranking_.28.221224.22_ranking.29
Instance Attribute Summary
Attributes inherited from Strategy
Instance Method Summary collapse
-
#execute ⇒ Object
Methods:.
Methods inherited from Strategy
#errors, #initialize, #rank, #rankings, #scores, #valid?
Constructor Details
This class inherits a constructor from Ranker::Strategies::Strategy
Instance Method Details
#execute ⇒ Object
Methods:
10 11 12 13 14 15 16 17 |
# File 'lib/ranker/strategies/standard_competition.rb', line 10 def execute rank = 1 scores_unique_sorted.each_with_index { |score, index| rankables_for_score = rankables_for_score(score) create_ranking(rank, score, rankables_for_score) rank += rankables_for_score.count } end |