Class: GameLeaderboardEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/steam/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



36
37
38
39
40
41
# File 'lib/steam/community/game_leaderboard_entry.rb', line 36

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:



29
30
31
# File 'lib/steam/community/game_leaderboard_entry.rb', line 29

def leaderboard
  @leaderboard
end

#rankFixnum (readonly)

Returns the rank where this entry is listed in the leaderboard

Returns:

  • (Fixnum)

    The rank of this entry



24
25
26
# File 'lib/steam/community/game_leaderboard_entry.rb', line 24

def rank
  @rank
end

#scoreFixnum (readonly)

Returns the score of this entry

Returns:

  • (Fixnum)

    The score of this player



19
20
21
# File 'lib/steam/community/game_leaderboard_entry.rb', line 19

def score
  @score
end

#steam_idSteamId (readonly)

Returns the Steam ID of this entry’s player

Returns:

  • (SteamId)

    The Steam ID of the player



14
15
16
# File 'lib/steam/community/game_leaderboard_entry.rb', line 14

def steam_id
  @steam_id
end