Class: Ranker::Strategies::Ordinal

Inherits:
Strategy
  • Object
show all
Defined in:
lib/ranker/strategies/ordinal.rb

Overview

Instance Attribute Summary

Attributes inherited from Strategy

#options, #rankables

Instance Method Summary collapse

Methods inherited from Strategy

#errors, #initialize, #rank, #rankings, #scores, #valid?

Constructor Details

This class inherits a constructor from Ranker::Strategies::Strategy

Instance Method Details

#executeObject

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