gamer_stats 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/bf3/bf3.rb +4 -3
- data/lib/gamer_stats/version.rb +1 -1
- data/test/bf3_test.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTM4MWUwYmVkZDk4ZTUwMzJkNzA2OGZmYmU1MjI5MTFhMmFkMjdhZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjE5MmViY2U0YTdmMzJjM2NlMDM0NWU2ZGQ5Y2QwZTdiNTIzOGNlZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTI1ZTRhYmUyZmJjMDY2NDEzN2ZiMjg2ZWQyMjZjYTQzYzUwMjU4OGRiNDJi
|
10
|
+
NzRjM2FkNmE4ODk4ODNkY2UzMjhmNTUyNGUyMmFjMzJkNWIzMTQyYzNiZTJm
|
11
|
+
MmY0MTcxNWQ1YjNhNWVkZTZmMWFhOWZiNmFhMzEzMDM3NzY3MmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDYxNzA0ZTM1ODA5NjNkMTMzMDMwMTUzY2ZmMThlZjA5OTQzMWIwYmM3Zjc2
|
14
|
+
OTA5MzAxNWQ1NTEzN2M5NWRkNzU0Nzg5YjFkMTJkMDczZjUwMzFhN2FjY2Mw
|
15
|
+
ODZmYzViN2JiY2E5OTVhZDRkZWQxNWE3MjU4YjY0Yjg4MTcxYzE=
|
data/lib/bf3/bf3.rb
CHANGED
@@ -6,7 +6,7 @@ module GamerStats
|
|
6
6
|
module Bf3
|
7
7
|
class Player
|
8
8
|
|
9
|
-
def initialize(name, platform, player =
|
9
|
+
def initialize(name, platform, player = {})
|
10
10
|
@name = name
|
11
11
|
@platform = platform
|
12
12
|
@player = player.deep_dup
|
@@ -37,18 +37,19 @@ module GamerStats
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def kdr
|
40
|
+
load
|
40
41
|
return get_current('global/kills').to_f / get_current('global/kills')
|
41
42
|
end
|
42
43
|
|
43
44
|
private
|
44
45
|
|
45
|
-
def loaded?(path)
|
46
|
+
def loaded?(path='')
|
46
47
|
val = @player.path(path)
|
47
48
|
false if val.nil? or val.empty?
|
48
49
|
end
|
49
50
|
|
50
51
|
def get_current(path)
|
51
|
-
@player.path(path)
|
52
|
+
@player.deep_dup.path(path)
|
52
53
|
end
|
53
54
|
|
54
55
|
def merge(player)
|
data/lib/gamer_stats/version.rb
CHANGED
data/test/bf3_test.rb
CHANGED
@@ -5,13 +5,14 @@ require 'minitest/autorun'
|
|
5
5
|
include GamerStats
|
6
6
|
|
7
7
|
describe Bf3::Player do
|
8
|
+
|
8
9
|
let(:player) { Bf3::Player.new 'SeriousM', 'pc' }
|
9
10
|
let(:non_player) { Bf3::Player.new 'xx', 'xx' }
|
10
11
|
|
11
12
|
describe 'getting a player' do
|
12
13
|
it 'should return the player requested' do
|
13
|
-
|
14
|
-
|
14
|
+
stats = player.load
|
15
|
+
stats['country'].wont_be_nil
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -37,7 +38,7 @@ describe Bf3::Player do
|
|
37
38
|
|
38
39
|
describe 'will throw an error when the player does not exist' do
|
39
40
|
it 'on load' do
|
40
|
-
->{
|
41
|
+
->{ non_player.load }.must_raise GamerStatsError
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|