Class: L4DMap
- Inherits:
-
Object
- Object
- L4DMap
- Defined in:
- lib/steam/community/l4d/l4d_map.rb
Overview
L4DMap holds statistical information about maps 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 ⇒ Object
readonly
Returns the value of attribute best_time.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#medal ⇒ Object
readonly
Returns the value of attribute medal.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#times_played ⇒ Object
readonly
Returns the value of attribute times_played.
Instance Method Summary collapse
-
#initialize(map_data) ⇒ L4DMap
constructor
Creates a new instance of L4DMap based on the assigned XML data.
Constructor Details
#initialize(map_data) ⇒ L4DMap
Creates a new instance of L4DMap based on the assigned XML data
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 18 def initialize(map_data) @best_time = map_data.elements['besttimeseconds'].text.to_f @id = map_data.name @name = map_data.elements['name'].text @times_played = map_data.elements['timesplayed'].text.to_i case map_data.elements['medal'].text 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 ⇒ Object (readonly)
Returns the value of attribute best_time.
10 11 12 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 10 def best_time @best_time end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 10 def id @id end |
#medal ⇒ Object (readonly)
Returns the value of attribute medal.
10 11 12 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 10 def medal @medal end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 10 def name @name end |
#times_played ⇒ Object (readonly)
Returns the value of attribute times_played.
10 11 12 |
# File 'lib/steam/community/l4d/l4d_map.rb', line 10 def times_played @times_played end |