bf3stats 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. data/lib/bf3stats.rb +22 -0
  2. data/lib/bf3stats/version.rb +1 -1
  3. metadata +2 -2
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Bf3stats
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-03 00:00:00.000000000 Z
12
+ date: 2012-09-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: bf3stats.com api client
15
15
  email: