ohm-tallyable 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/ohm/tallyable.rb +4 -7
- data/ohm-tallyable.gemspec +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MThkM2VkOTljMmQ4ZmIzNzc4YzE0NGZiN2U1ZGNjNWEyZDdhYzU0Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDIwYmEwOWJlYTM3ODA3Y2Y0YmIzYzcxZTg0ZGE4Y2RjMzkxMDIzMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDkxMWE0M2Y3ZWQ3ZTc2OWVlNDMwZTJmZjM3YzhiY2ViYzFjOGU1Y2Q5MjEx
|
10
|
+
NTg0ZWM2YTkzYzM4ZjY5OGNhNmJjY2VlZTBlN2NmNmU5NjNlMDA3NGFiNDA4
|
11
|
+
YzZlYmE5ZjFiZTFiNGNmNGRiYmQzMmI0MDE4Yzc2MmExM2I0ZmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjdlYmZmZmIxNWE2NGU3NGU1NWNlZGEwZTY1ZDM5NmI4ZmQyMzc5MGQyN2Vm
|
14
|
+
NWQ0MWIwOTM3OTA1MWE3MWEzNWUwNDZkMTFiZTZkMjY4NzAzODMxNzg5NzNk
|
15
|
+
MjAyZDMwMzZiZmVjNzgwODg5YjdhMDE3ZjhmMzIzMDNkOTJlZmE=
|
data/lib/ohm/tallyable.rb
CHANGED
@@ -62,13 +62,10 @@ module Ohm
|
|
62
62
|
|
63
63
|
def _update_tallies(amount, &block)
|
64
64
|
self.class.tallies.each do |attribute, options|
|
65
|
-
|
66
|
-
key = self.class.
|
67
|
-
|
68
|
-
|
69
|
-
key = key[options[:by]][value_by]
|
70
|
-
end
|
71
|
-
if value
|
65
|
+
by = options[:by] ? {options[:by] => yield(options[:by])} : nil
|
66
|
+
key = self.class._tally_key(attribute, by)
|
67
|
+
|
68
|
+
if (value = yield(attribute))
|
72
69
|
key.zincrby(amount, value)
|
73
70
|
key.zrem(value) if key.zscore(value) == 0.0
|
74
71
|
end
|
data/ohm-tallyable.gemspec
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'ohm-tallyable'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.3'
|
4
4
|
s.summary = "Ohm Tally Plugin"
|
5
5
|
s.description = "A tally plugin for Ohm that keeps counts of records for every value of an attribute"
|
6
6
|
s.author = "Federico Bond"
|
7
7
|
s.email = 'federico@educabilia.com'
|
8
8
|
s.files = Dir["UNLICENSE", "README.md", "Rakefile", "lib/**/*.rb", "*.gemspec", "test/*.*"]
|
9
9
|
s.homepage = 'https://github.com/educabilia/ohm-tallyable'
|
10
|
+
s.license = 'UNLICENSE'
|
10
11
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohm-tallyable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Bond
|
@@ -25,7 +25,8 @@ files:
|
|
25
25
|
- test/test-tallyable.rb
|
26
26
|
- test/test.conf
|
27
27
|
homepage: https://github.com/educabilia/ohm-tallyable
|
28
|
-
licenses:
|
28
|
+
licenses:
|
29
|
+
- UNLICENSE
|
29
30
|
metadata: {}
|
30
31
|
post_install_message:
|
31
32
|
rdoc_options: []
|