Module: AbstractL4DWeapon

Includes:
GameWeapon
Included in:
L4D2Weapon, L4DWeapon
Defined in:
lib/steam/community/l4d/abstract_l4d_weapon.rb

Instance Attribute Summary collapse

Attributes included from GameWeapon

#id, #kills, #shots

Instance Method Summary collapse

Methods included from GameWeapon

#avg_shots_per_kill

Instance Attribute Details

#accuracyObject (readonly)

Returns the value of attribute accuracy.



12
13
14
# File 'lib/steam/community/l4d/abstract_l4d_weapon.rb', line 12

def accuracy
  @accuracy
end

#headshots_percentageObject (readonly)

Returns the value of attribute headshots_percentage.



12
13
14
# File 'lib/steam/community/l4d/abstract_l4d_weapon.rb', line 12

def headshots_percentage
  @headshots_percentage
end

#kill_percentageObject (readonly)

Returns the value of attribute kill_percentage.



12
13
14
# File 'lib/steam/community/l4d/abstract_l4d_weapon.rb', line 12

def kill_percentage
  @kill_percentage
end

Instance Method Details

#initialize(weapon_data) ⇒ Object

Abstract base constructor which parses common data for both, L4DWeapon and L4D2Weapon



16
17
18
19
20
21
22
23
# File 'lib/steam/community/l4d/abstract_l4d_weapon.rb', line 16

def initialize(weapon_data)
  super weapon_data

  @accuracy             = weapon_data.elements['accuracy'].text
  @headshots_percentage = weapon_data.elements['headshots'].text
  @id                   = weapon_data.name
  @shots                = weapon_data.elements['shots'].text.to_i
end