gamer_stats 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjI5ODgxYTI1YWE2ODUzOTUyOWZmZmEzZTE0OTZmZWQwZjg4ZTUxNg==
4
+ YTM4MWUwYmVkZDk4ZTUwMzJkNzA2OGZmYmU1MjI5MTFhMmFkMjdhZQ==
5
5
  data.tar.gz: !binary |-
6
- NjRhNmEwZmVkZDk2NDliODdhNzU4YWYzNzQ4MTQyMDE1OWVmNzRiYQ==
6
+ MjE5MmViY2U0YTdmMzJjM2NlMDM0NWU2ZGQ5Y2QwZTdiNTIzOGNlZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Nzg3YWNiMTQ2NjMyYjRjNzVjZjY2OTllMzY1MjExZWFjNGJmODNmOWI5M2Vm
10
- ZDE0MDI5OWM2YTc0YTA0NDU3MGMwMjY1ZmJkNTdmZWQyNmQ5Njg0OTcwOWZl
11
- NmNkOTQyMzc2MzY2MjQ1MWZkOWJmZTllMDU1OTg3N2I2MWMyZTI=
9
+ MTI1ZTRhYmUyZmJjMDY2NDEzN2ZiMjg2ZWQyMjZjYTQzYzUwMjU4OGRiNDJi
10
+ NzRjM2FkNmE4ODk4ODNkY2UzMjhmNTUyNGUyMmFjMzJkNWIzMTQyYzNiZTJm
11
+ MmY0MTcxNWQ1YjNhNWVkZTZmMWFhOWZiNmFhMzEzMDM3NzY3MmY=
12
12
  data.tar.gz: !binary |-
13
- NGZiMzhlNjMwNGNjYzVmYzgyMzg1YjQwMDFlZjU4Y2IyZmRiMjZiMjVjODZj
14
- MzFmMDU1Mzg5NWE4YzMyYzA5OWNlNTg5YTAzZjBjZmUxOWFhNWJiOTIxNTZl
15
- OTMwYTY4YWJkNGYwMDE0YjhlYTZiMTRhMzE2YzE1OTE1MDA1NTU=
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).deep_dup
52
+ @player.deep_dup.path(path)
52
53
  end
53
54
 
54
55
  def merge(player)
@@ -1,3 +1,3 @@
1
1
  module GamerStats
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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
- player = @player.load
14
- player['country'].wont_be_nil
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
- ->{@non_player.load}.must_raise GamerStatsError
41
+ ->{ non_player.load }.must_raise GamerStatsError
41
42
  end
42
43
  end
43
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamer_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SeriousM - Bernhard Millauer