Class: Glicko2::Player
- Inherits:
-
Object
- Object
- Glicko2::Player
- Defined in:
- lib/glicko2/player.rb
Overview
Player maps a seed object with a Glicko2 rating.
Instance Attribute Summary collapse
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
-
#rating ⇒ Object
readonly
Returns the value of attribute rating.
Class Method Summary collapse
-
.from_obj(obj) ⇒ Player
Create a Player from a seed object, converting from Glicko ratings to Glicko2.
Instance Method Summary collapse
-
#initialize(rating, obj) ⇒ Player
constructor
A new instance of Player.
- #mean ⇒ Object
- #sd ⇒ Object
- #to_s ⇒ Object
-
#update_obj ⇒ Object
Update seed object with this player’s values.
- #volatility ⇒ Object
Constructor Details
#initialize(rating, obj) ⇒ Player
Returns a new instance of Player.
16 17 18 19 |
# File 'lib/glicko2/player.rb', line 16 def initialize(, obj) = @obj = obj end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
4 5 6 |
# File 'lib/glicko2/player.rb', line 4 def obj @obj end |
#rating ⇒ Object (readonly)
Returns the value of attribute rating.
4 5 6 |
# File 'lib/glicko2/player.rb', line 4 def end |
Class Method Details
.from_obj(obj) ⇒ Player
Create a Glicko2::Player from a seed object, converting from Glicko ratings to Glicko2.
11 12 13 14 |
# File 'lib/glicko2/player.rb', line 11 def self.from_obj(obj) = Rating.(obj., obj., obj.volatility) new(, obj) end |
Instance Method Details
#mean ⇒ Object
29 30 31 |
# File 'lib/glicko2/player.rb', line 29 def mean .mean end |
#sd ⇒ Object
33 34 35 |
# File 'lib/glicko2/player.rb', line 33 def sd .sd end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/glicko2/player.rb', line 41 def to_s "#<Player rating=#{rating}, obj=#{obj}>" end |
#update_obj ⇒ Object
Update seed object with this player’s values
22 23 24 25 26 27 |
# File 'lib/glicko2/player.rb', line 22 def update_obj mean, sd = . @obj. = mean @obj. = sd @obj.volatility = volatility end |
#volatility ⇒ Object
37 38 39 |
# File 'lib/glicko2/player.rb', line 37 def volatility .volatility end |