Class: Ranker::Strategies::Ordinal
- Defined in:
- lib/ranker/strategies/ordinal.rb
Overview
Ranks rankables according to: en.wikipedia.org/wiki/Ranking#Ordinal_ranking_.28.221234.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 18 19 |
# File 'lib/ranker/strategies/ordinal.rb', line 10 def execute rank = 1 scores_unique_sorted.each_with_index { |score, index| rankables_for_score = rankables_for_score(score) rankables_for_score.each { |value| create_ranking(rank, score, [value]) rank += 1 } } end |