Module: Ranker

Defined in:
lib/ranker.rb,
lib/ranker/error.rb,
lib/ranker/ranking.rb,
lib/ranker/version.rb,
lib/ranker/rankings.rb

Overview

Ranks are based on: en.wikipedia.org/wiki/Ranking

Defined Under Namespace

Modules: Strategies Classes: Error, Ranking, Rankings

Constant Summary collapse

VERSION =
'1.1.4'

Class Method Summary collapse

Class Method Details

.rank(rankables, *args) ⇒ Object

Methods:



27
28
29
30
31
32
33
34
35
36
# File 'lib/ranker.rb', line 27

def rank(rankables, *args)
  options = args.pop
  if options && options.kind_of?(Hash)
    options = default_options.merge(options)
  else
    options = default_options
  end
  strategy = get_strategy(rankables, options)
  strategy.rank
end

.strategiesObject

Properties:



16
17
18
19
20
21
22
23
# File 'lib/ranker.rb', line 16

def strategies
  @strategies ||= {
    :standard_competition => Ranker::Strategies::StandardCompetition,
    :modified_competition => Ranker::Strategies::ModifiedCompetition,
    :dense => Ranker::Strategies::Dense,
    :ordinal => Ranker::Strategies::Ordinal
  }
end