Class: DoDSStats
- Defined in:
- lib/steam/community/dods/dods_stats.rb
Overview
The is class represents the game statistics for a single user in Day of Defeat: Source
Instance Attribute Summary
Attributes inherited from GameStats
#game, #hours_played, #privacy_state, #user
Instance Method Summary collapse
-
#class_stats ⇒ Hash<String, DoDSClass>
Returns a hash of ‘DoDSClass` for this user containing all DoD:S classes.
-
#initialize(steam_id, fetch = true, bypass_cache = false) ⇒ DoDSStats
constructor
Creates a ‘DoDSStats` instance by calling the super constructor with the game name `’DoD:S’‘.
-
#weapon_stats ⇒ Hash<String, DoDSWeapon>
Returns a Hash of ‘DoDSWeapon` for this user containing all DoD:S weapons.
Methods inherited from GameStats
#achievements, #achievements_done, #achievements_percentage, base_url, #base_url, create_game_stats, #public?
Methods included from XMLData
Constructor Details
#initialize(steam_id, fetch = true, bypass_cache = false) ⇒ DoDSStats
Creates a ‘DoDSStats` instance by calling the super constructor with the game name `’DoD:S’‘
22 23 24 |
# File 'lib/steam/community/dods/dods_stats.rb', line 22 def initialize(steam_id) super steam_id, 'DoD:S' end |
Instance Method Details
#class_stats ⇒ Hash<String, DoDSClass>
Returns a hash of ‘DoDSClass` for this user containing all DoD:S classes.
If the classes haven’t been parsed already, parsing is done now.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/steam/community/dods/dods_stats.rb', line 31 def class_stats return unless public? if @class_stats.nil? @class_stats = {} @xml_data['stats']['classes']['class'].each do |class_data| @class_stats[class_data['key']] = DoDSClass.new class_data end end @class_stats end |
#weapon_stats ⇒ Hash<String, DoDSWeapon>
Returns a Hash of ‘DoDSWeapon` for this user containing all DoD:S weapons.
If the weapons haven’t been parsed already, parsing is done now.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/steam/community/dods/dods_stats.rb', line 49 def weapon_stats return unless public? if @weapon_stats.nil? @weapon_stats = {} @xml_data['stats']['weapons']['weapon'].each do |weapon_data| @weapon_stats[weapon_data['key']] = DoDSWeapon.new weapon_data end end @weapon_stats end |