Class: Tassadar::SC2::Replay
- Inherits:
-
Object
- Object
- Tassadar::SC2::Replay
- Defined in:
- lib/tassadar/sc2/replay.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#details ⇒ Object
Returns the value of attribute details.
-
#game ⇒ Object
Returns the value of attribute game.
-
#mpq ⇒ Object
Returns the value of attribute mpq.
-
#players ⇒ Object
Returns the value of attribute players.
Instance Method Summary collapse
-
#initialize(filename, data = nil) ⇒ Replay
constructor
A new instance of Replay.
Constructor Details
#initialize(filename, data = nil) ⇒ Replay
Returns a new instance of Replay.
13 14 15 16 17 18 19 20 |
# File 'lib/tassadar/sc2/replay.rb', line 13 def initialize(filename, data=nil) @mpq = MPQ::MPQ.read(data.nil? ? File.read(filename) : data) @attributes = Attributes.read(@mpq.read_file("replay.attributes.events")) @details = Details.read(@mpq.read_file("replay.details")) @players = @details.data[0].map {|h| Player.new(h, @attributes.attributes)} @game = Game.new(self) end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/tassadar/sc2/replay.rb', line 11 def attributes @attributes end |
#details ⇒ Object
Returns the value of attribute details.
11 12 13 |
# File 'lib/tassadar/sc2/replay.rb', line 11 def details @details end |
#game ⇒ Object
Returns the value of attribute game.
11 12 13 |
# File 'lib/tassadar/sc2/replay.rb', line 11 def game @game end |
#mpq ⇒ Object
Returns the value of attribute mpq.
11 12 13 |
# File 'lib/tassadar/sc2/replay.rb', line 11 def mpq @mpq end |
#players ⇒ Object
Returns the value of attribute players.
11 12 13 |
# File 'lib/tassadar/sc2/replay.rb', line 11 def players @players end |