Module: TF2ClassFactory
- Defined in:
- lib/steam/community/tf2/tf2_class_factory.rb
Overview
The TF2ClassFactory is used to created instances of TF2Class based on the XML input data
Class Method Summary collapse
-
.tf2_class(class_data) ⇒ TF2Class
Creates a new instance of a TF2 class instance based on the given XML data.
Class Method Details
.tf2_class(class_data) ⇒ TF2Class
Creates a new instance of a TF2 class instance based on the given XML data
This returns an instance of TF2Class or its subclasses TF2Engineer, TF2Medic, TF2Sniper or TF2Spy depending on the given XML data.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/steam/community/tf2/tf2_class_factory.rb', line 25 def self.tf2_class(class_data) case class_data['className'] when 'Engineer' then return TF2Engineer.new(class_data) when 'Medic' then return TF2Medic.new(class_data) when 'Sniper' then return TF2Sniper.new(class_data) when 'Spy' then return TF2Spy.new(class_data) else return TF2Class.new(class_data) end end |