tassadar 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,8 +10,8 @@ module Tassadar
10
10
  class Replay
11
11
  attr_accessor :mpq, :attributes, :details, :players, :game
12
12
 
13
- def initialize(filename)
14
- @mpq = MPQ::MPQ.read(File.read(filename))
13
+ def initialize(filename, data=nil)
14
+ @mpq = MPQ::MPQ.read(data.nil? ? File.read(filename) : data)
15
15
  @attributes = Attributes.read(@mpq.read_file("replay.attributes.events"))
16
16
  @details = Details.read(@mpq.read_file("replay.details"))
17
17
 
@@ -1,3 +1,3 @@
1
1
  module Tassadar
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tassadar::SC2::Game do
4
+ before(:each) do
5
+ @replay = Tassadar::SC2::Replay.new(File.join(REPLAY_DIR, "patch150.SC2Replay"))
6
+ @replay_from_data = Tassadar::SC2::Replay.new(nil, File.read(File.join(REPLAY_DIR, "patch150.SC2Replay")))
7
+ end
8
+
9
+ it "should have the same result" do
10
+ @replay.game.winner.name.should == @replay_from_data.game.winner.name
11
+ end
12
+
13
+ it "should have players" do
14
+ @replay.players.should be_true
15
+ @replay_from_data.players.should be_true
16
+ end
17
+
18
+ it "should have game" do
19
+ @replay.game.should be_true
20
+ @replay_from_data.game.should be_true
21
+ end
22
+
23
+ it "should have details" do
24
+ @replay.details.should be_true
25
+ @replay_from_data.details.should be_true
26
+ end
27
+
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tassadar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-18 00:00:00.000000000 Z
13
+ date: 2013-01-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bindata
@@ -106,6 +106,7 @@ files:
106
106
  - spec/tassadar/mpq_spec.rb
107
107
  - spec/tassadar/sc2/game_spec.rb
108
108
  - spec/tassadar/sc2/player_spec.rb
109
+ - spec/tassadar/sc2/replay_spec.rb
109
110
  - spec/tassadar/version_spec.rb
110
111
  - tassadar.gemspec
111
112
  homepage: https://github.com/agoragames/tassadar
@@ -120,12 +121,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
121
  - - ! '>='
121
122
  - !ruby/object:Gem::Version
122
123
  version: '0'
124
+ segments:
125
+ - 0
126
+ hash: 2424216686909985367
123
127
  required_rubygems_version: !ruby/object:Gem::Requirement
124
128
  none: false
125
129
  requirements:
126
130
  - - ! '>='
127
131
  - !ruby/object:Gem::Version
128
132
  version: '0'
133
+ segments:
134
+ - 0
135
+ hash: 2424216686909985367
129
136
  requirements: []
130
137
  rubyforge_project: tassadar
131
138
  rubygems_version: 1.8.24
@@ -145,4 +152,5 @@ test_files:
145
152
  - spec/tassadar/mpq_spec.rb
146
153
  - spec/tassadar/sc2/game_spec.rb
147
154
  - spec/tassadar/sc2/player_spec.rb
155
+ - spec/tassadar/sc2/replay_spec.rb
148
156
  - spec/tassadar/version_spec.rb