leaderboard 3.12.0 → 3.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +1 -1
- data/lib/leaderboard.rb +8 -1
- data/lib/leaderboard/version.rb +1 -1
- data/spec/version_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19558a28d4b7285898e103a6942f1d5df5c1dc8c
|
4
|
+
data.tar.gz: e8f02004a685670302caa7070f7299cb8d41640d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10d7e059b37014fa0afa7fd154ba0c6275fa84e248fbc0db203fe965a73d0108fa80bdb295a54ef678d8e4245312fdab6bc858fb76fb274ba5e25ab1830afd85
|
7
|
+
data.tar.gz: 34e77796159e0325d5ba92ecdc4fa9073785b2f3d84351785f8b64b50f859093ed9ea8b883028f9c0042ae730cdcd2d21928bd4022c33f6257873f0e7ae48736
|
data/CHANGELOG.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
## 3.12.
|
3
|
+
## 3.12.1 (2017-02-03)
|
4
4
|
|
5
5
|
* Fixed an error with the `ranked_in_list` method when using certain options [#62](https://github.com/agoragames/leaderboard/pull/62)
|
6
6
|
* Added `total_scores` method [#63](https://github.com/agoragames/leaderboard/pull/63)
|
data/lib/leaderboard.rb
CHANGED
@@ -373,7 +373,14 @@ class Leaderboard
|
|
373
373
|
#
|
374
374
|
# @return Sum of scores for all members in leaderboard
|
375
375
|
def total_scores
|
376
|
-
|
376
|
+
total_scores_in(@leaderboard_name)
|
377
|
+
end
|
378
|
+
|
379
|
+
# Sum of scores for all members in the named leaderboard
|
380
|
+
#
|
381
|
+
# @return Sum of scores for all members in named leaderboard
|
382
|
+
def total_scores_in(leaderboard_name)
|
383
|
+
all_leaders_from(leaderboard_name).map{|hash| hash[:score] }.inject(0, :+)
|
377
384
|
end
|
378
385
|
|
379
386
|
# Change the score for a member in the leaderboard by a score delta which can be positive or negative.
|
data/lib/leaderboard/version.rb
CHANGED
data/spec/version_spec.rb
CHANGED