class Omega::ScoreboardEntry

Attributes

problems[RW]
username[R]

Public Class Methods

new(client, entry) click to toggle source
Calls superclass method Omega::Base::new
# File lib/omega/scoreboard.rb, line 10
def initialize(client, entry)
  @username = entry[:username]
  @problems = entry[:problems] || []
  super(client, entry)
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/omega/scoreboard.rb, line 30
def <=>(other)
  other.data[:total][:points] <=> @data[:total][:points]
end
merge(score) click to toggle source
# File lib/omega/scoreboard.rb, line 16
def merge(score)
  result = clone
  result.problems += score.problems
  result.data[:total][:points] += score.data[:total][:points]
  result
end
score_for(name) click to toggle source
# File lib/omega/scoreboard.rb, line 34
def score_for(name)
  problems.each do |problem|
    return problem if problem[:alias] == name
  end
  nil
end
simple_display() click to toggle source
# File lib/omega/scoreboard.rb, line 23
def simple_display
  {
    username: @data[:username],
    score: @data[:total][:points]
  }
end