Class: EloRankable::EloRanking

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/elo_rankable/elo_ranking.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = nil) ⇒ EloRanking

Returns a new instance of EloRanking.



13
14
15
16
17
# File 'lib/elo_rankable/elo_ranking.rb', line 13

def initialize(attributes = nil)
  super
  self.rating ||= EloRankable.config.base_rating
  self.games_played ||= 0
end

Instance Method Details

#k_factorObject



19
20
21
# File 'lib/elo_rankable/elo_ranking.rb', line 19

def k_factor
  EloRankable.config.k_factor_for(rating)
end