counterman 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.
- checksums.yaml +4 -4
- data/counterman.gemspec +1 -1
- data/lib/counterman.rb +1 -13
- 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: b15f287c962b9008501e517ed42562727bae1a87
|
4
|
+
data.tar.gz: a40596670152e2525b3a20697dfae93ede01b512
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 692ffa84d67351fb0b1dc5e627f65c13f4be6b0982c815664df12c4df7a99c40726cf8651a2bea1fa6889135f3ff121fdd25d67369b01a13720bee08bdf35b61
|
7
|
+
data.tar.gz: 64a98da2c5c39af89f93e2900eb16892ef3fd402fe7f64e5b29cce7469d86ec4ac19d1e081d7afff82d1bb4ea471364c9e7b94f9f78fa8f3b84b376d54f98321
|
data/counterman.gemspec
CHANGED
data/lib/counterman.rb
CHANGED
@@ -31,24 +31,12 @@ class Counterman
|
|
31
31
|
def initialize(options = {})
|
32
32
|
|
33
33
|
self.options = default_options.merge!(options)
|
34
|
+
self.redis = options[:redis] || Redis.new
|
34
35
|
|
35
36
|
spans = self.options.fetch(:time_spans, %w[year month week day hour minute])
|
36
37
|
@time_spans = generate_spans(spans)
|
37
38
|
end
|
38
39
|
|
39
|
-
# Public: Lazily Instantiate and memoize the Redis connection
|
40
|
-
#
|
41
|
-
def redis
|
42
|
-
@redis ||= case options[:redis]
|
43
|
-
when nil
|
44
|
-
Redis.new
|
45
|
-
when Hash
|
46
|
-
Redis.new options[:redis]
|
47
|
-
else
|
48
|
-
options[:redis]
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
40
|
|
53
41
|
# Public: Marks an id to a given event on a given time
|
54
42
|
#
|