bf3stats 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bf3stats.rb +22 -0
- data/lib/bf3stats/version.rb +1 -1
- metadata +2 -2
data/lib/bf3stats.rb
CHANGED
@@ -36,5 +36,27 @@ module Bf3stats
|
|
36
36
|
def kdr
|
37
37
|
kills.to_f / deaths.to_f
|
38
38
|
end
|
39
|
+
|
40
|
+
def weapons(limit=5)
|
41
|
+
@raw_stats['weapons'].values.map{|stats| WeaponScore.new(stats) }.sort{|a,b| b.kills <=> a.kills }[0...limit]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class WeaponScore
|
46
|
+
def initialize(raw_stats)
|
47
|
+
@raw_stats = raw_stats
|
48
|
+
end
|
49
|
+
|
50
|
+
def inspect
|
51
|
+
"#<#{self.class}:#{object_id} @name=#{name} @kills=#{kills}>"
|
52
|
+
end
|
53
|
+
|
54
|
+
def name
|
55
|
+
@raw_stats['name']
|
56
|
+
end
|
57
|
+
|
58
|
+
def kills
|
59
|
+
@raw_stats['kills']
|
60
|
+
end
|
39
61
|
end
|
40
62
|
end
|
data/lib/bf3stats/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bf3stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: bf3stats.com api client
|
15
15
|
email:
|