Class: SteamCondenser::Community::GameLeaderboardEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/steam-condenser/community/game_leaderboard_entry.rb

Overview

The GameLeaderboard class represents a single entry in a leaderboard

Author:

  • Sebastian Staudt

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry_data, leaderboard) ⇒ GameLeaderboardEntry

Creates new entry instance for the given XML data and leaderboard

Parameters:

  • entry_data (Hash<String, Object>)

    The XML data of the leaderboard of the leaderboard entry

  • leaderboard (GameLeaderboard)

    The leaderboard this entry belongs to


39
40
41
42
43
44
# File 'lib/steam-condenser/community/game_leaderboard_entry.rb', line 39

def initialize(entry_data, leaderboard)
  @steam_id    = SteamId.new entry_data['steamid'].to_i, false
  @score       = entry_data['score'].to_i
  @rank        = entry_data['rank'].to_i
  @leaderboard = leaderboard
end

Instance Attribute Details

#leaderboardGameLeaderboard (readonly)

Returns the leaderboard this entry belongs to

Returns:


31
32
33
# File 'lib/steam-condenser/community/game_leaderboard_entry.rb', line 31

def leaderboard
  @leaderboard
end

#rankFixnum (readonly)

Returns the rank where this entry is listed in the leaderboard

Returns:

  • (Fixnum)

    The rank of this entry


26
27
28
# File 'lib/steam-condenser/community/game_leaderboard_entry.rb', line 26

def rank
  @rank
end

#scoreFixnum (readonly)

Returns the score of this entry

Returns:

  • (Fixnum)

    The score of this player


21
22
23
# File 'lib/steam-condenser/community/game_leaderboard_entry.rb', line 21

def score
  @score
end

#steam_idSteamId (readonly)

Returns the Steam ID of this entry's player

Returns:

  • (SteamId)

    The Steam ID of the player


16
17
18
# File 'lib/steam-condenser/community/game_leaderboard_entry.rb', line 16

def steam_id
  @steam_id
end