Class: OpenSkill::Models::BradleyTerryPart::TeamRating

Inherits:
Object
  • Object
show all
Defined in:
lib/openskill/models/bradley_terry_part.rb

Overview

Internal class for team ratings

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mu:, sigma_squared:, team:, rank:) ⇒ TeamRating

Returns a new instance of TeamRating.



355
356
357
358
359
360
# File 'lib/openskill/models/bradley_terry_part.rb', line 355

def initialize(mu:, sigma_squared:, team:, rank:)
  @mu = mu.to_f
  @sigma_squared = sigma_squared.to_f
  @team = team
  @rank = rank.to_i
end

Instance Attribute Details

#muObject (readonly)

Returns the value of attribute mu.



353
354
355
# File 'lib/openskill/models/bradley_terry_part.rb', line 353

def mu
  @mu
end

#rankObject (readonly)

Returns the value of attribute rank.



353
354
355
# File 'lib/openskill/models/bradley_terry_part.rb', line 353

def rank
  @rank
end

#sigma_squaredObject (readonly)

Returns the value of attribute sigma_squared.



353
354
355
# File 'lib/openskill/models/bradley_terry_part.rb', line 353

def sigma_squared
  @sigma_squared
end

#teamObject (readonly)

Returns the value of attribute team.



353
354
355
# File 'lib/openskill/models/bradley_terry_part.rb', line 353

def team
  @team
end

Instance Method Details

#==(other) ⇒ Object



362
363
364
365
366
367
368
369
# File 'lib/openskill/models/bradley_terry_part.rb', line 362

def ==(other)
  return false unless other.is_a?(TeamRating)

  @mu == other.mu &&
    @sigma_squared == other.sigma_squared &&
    @team == other.team &&
    @rank == other.rank
end

#hashObject



371
372
373
# File 'lib/openskill/models/bradley_terry_part.rb', line 371

def hash
  [@mu, @sigma_squared, @team, @rank].hash
end

#to_sObject



375
376
377
# File 'lib/openskill/models/bradley_terry_part.rb', line 375

def to_s
  "TeamRating(mu=#{@mu}, sigma_squared=#{@sigma_squared}, rank=#{@rank})"
end