Class: L4DMap
- Inherits:
-
Object
- Object
- L4DMap
- Defined in:
- lib/steam/community/l4d/l4d_map.rb
Overview
This class holds statistical information about a map played by a player in Survival mode of Left4Dead
Direct Known Subclasses
Constant Summary collapse
- GOLD =
1
- SILVER =
2
- BRONZE =
3
- NONE =
0
Instance Attribute Summary collapse
-
#best_time ⇒ Float
readonly
Returns the best survival time of this player on this map.
-
#id ⇒ String
readonly
Returns the ID of this map.
-
#medal ⇒ Fixnum
readonly
Returns the highest medal this player has won on this map.
-
#name ⇒ String
readonly
Returns the name of the map.
-
#times_played ⇒ Fixnum
readonly
Returns the number of times this map has been played by this player.
Instance Method Summary collapse
-
#initialize(map_name, map_data) ⇒ L4DMap
constructor
Creates a new instance of a Left4Dead Survival map based on the given XML data.
Constructor Details
#initialize(map_name, map_data) ⇒ L4DMap
Creates a new instance of a Left4Dead Survival map based on the given XML data
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 47 def initialize(map_name, map_data) @best_time = map_data['besttimeseconds'].to_f @id = map_name @name = map_data['name'] @times_played = map_data['timesplayed'].to_i case map_data['medal'] when 'gold' @medal = L4DMap::GOLD when 'silver' @medal = L4DMap::SILVER when 'bronze' @medal = L4DMap::BRONZE else @medal = L4DMap::NONE end end |
Instance Attribute Details
#best_time ⇒ Float (readonly)
Returns the best survival time of this player on this map
15 16 17 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 15 def best_time @best_time end |
#id ⇒ String (readonly)
Returns the ID of this map
20 21 22 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 20 def id @id end |
#medal ⇒ Fixnum (readonly)
Returns the highest medal this player has won on this map
25 26 27 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 25 def medal @medal end |
#name ⇒ String (readonly)
Returns the name of the map
30 31 32 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 30 def name @name end |
#times_played ⇒ Fixnum (readonly)
Returns the number of times this map has been played by this player
35 36 37 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 35 def times_played @times_played end |