Class: Tassadar::SC2::Game
- Inherits:
-
Object
- Object
- Tassadar::SC2::Game
- Defined in:
- lib/tassadar/sc2/game.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#map ⇒ Object
Returns the value of attribute map.
-
#speed ⇒ Object
Returns the value of attribute speed.
-
#time ⇒ Object
Returns the value of attribute time.
-
#type ⇒ Object
Returns the value of attribute type.
-
#winner ⇒ Object
Returns the value of attribute winner.
Instance Method Summary collapse
-
#initialize(replay) ⇒ Game
constructor
A new instance of Game.
Constructor Details
#initialize(replay) ⇒ Game
Returns a new instance of Game.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/tassadar/sc2/game.rb', line 6 def initialize(replay) @winner = replay.players.select {|p| p.won}.first @time = convert_windows_to_ruby_date_time(replay.details.data[5], replay.details.data[6]) @map = replay.details.data[1] @type = replay.attributes.attributes.select {|a| a.id == 2001}.first.attribute_value speeds = {"Fasr" => "Faster", "Slow" => "Slow", "Fast" => "Fast", "Norm" => "Normal", "Slor" => "Slower"} @speed = speeds[replay.attributes.attributes.select {|a| a.id == 3000}.first.attribute_value] categories = {"Amm" => "Ladder", "Priv" => "Private", "Pub" => "Public"} @category = categories[replay.attributes.attributes.select {|a| a.id == 3009}.first.attribute_value] end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
4 5 6 |
# File 'lib/tassadar/sc2/game.rb', line 4 def category @category end |
#map ⇒ Object
Returns the value of attribute map.
4 5 6 |
# File 'lib/tassadar/sc2/game.rb', line 4 def map @map end |
#speed ⇒ Object
Returns the value of attribute speed.
4 5 6 |
# File 'lib/tassadar/sc2/game.rb', line 4 def speed @speed end |
#time ⇒ Object
Returns the value of attribute time.
4 5 6 |
# File 'lib/tassadar/sc2/game.rb', line 4 def time @time end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/tassadar/sc2/game.rb', line 4 def type @type end |
#winner ⇒ Object
Returns the value of attribute winner.
4 5 6 |
# File 'lib/tassadar/sc2/game.rb', line 4 def winner @winner end |