norton 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f5a4ff328dfed5e74fa6b802ad45f4bf46c9be0
4
- data.tar.gz: 1b9dd9d48d2b9efeb697d3d683c9b3ca6659d615
3
+ metadata.gz: e366ba864730fb31251486d7479e432cda85e9ba
4
+ data.tar.gz: cc2c33ec37f5a2ce287546fa341a6cfba5bdd4e8
5
5
  SHA512:
6
- metadata.gz: ef958732f7752f2ca4c6c898d2732d35a37f36df75e1d82f433510706a14ccd8fe555d92d18fd5ab10236eb6ae73ba050b60a57f48692be78eb4db1243c6baeb
7
- data.tar.gz: 70c4752494cb26886d70afc19a13699a3430953f8c5fcffee51e5111c30bdb540bf197cf5ec0a1a746e56302cc1347088c74aa26fe0e08256985795d1d7dd1ab
6
+ metadata.gz: 2e3fed01e4b0c1135df0e69d214dbf52fe56b1cd4ac6c88690604502be9db2ce78240170714cda8ffc02047d23ffdcc38451760a692434fc5af952a8d152573c
7
+ data.tar.gz: 1111b8b4ffb59c9b2108fe6ea76502241144e624455398d120434656abc38d2da6bb623070a792aa058d1579f2e1be1c617107cb4f588f23183f887d68bdb0ab
@@ -13,25 +13,25 @@ module Norton
13
13
  def counter(name, options={}, &blk)
14
14
  define_method(name) do
15
15
  Norton.redis.with do |conn|
16
- conn.get("#{self.class.to_s.pluralize.downcase}:#{self.id}:#{name}").try(:to_i) || 0
16
+ conn.get("#{self.class.to_s.pluralize.underscore}:#{self.id}:#{name}").try(:to_i) || 0
17
17
  end
18
18
  end
19
19
 
20
20
  define_method("incr_#{name}") do
21
21
  Norton.redis.with do |conn|
22
- conn.incr("#{self.class.to_s.pluralize.downcase}:#{self.id}:#{name}")
22
+ conn.incr("#{self.class.to_s.pluralize.underscore}:#{self.id}:#{name}")
23
23
  end
24
24
  end
25
25
 
26
26
  define_method("decr_#{name}") do
27
27
  Norton.redis.with do |conn|
28
- conn.decr("#{self.class.to_s.pluralize.downcase}:#{self.id}:#{name}")
28
+ conn.decr("#{self.class.to_s.pluralize.underscore}:#{self.id}:#{name}")
29
29
  end
30
30
  end
31
31
 
32
32
  define_method("#{name}=") do |v|
33
33
  Norton.redis.with do |conn|
34
- conn.set("#{self.class.to_s.pluralize.downcase}:#{self.id}:#{name}", v)
34
+ conn.set("#{self.class.to_s.pluralize.underscore}:#{self.id}:#{name}", v)
35
35
  end
36
36
  end
37
37
 
@@ -39,7 +39,7 @@ module Norton
39
39
  count = instance_eval(&blk)
40
40
 
41
41
  Norton.redis.with do |conn|
42
- conn.set("#{self.class.to_s.pluralize.downcase}:#{self.id}:#{name}", count)
42
+ conn.set("#{self.class.to_s.pluralize.underscore}:#{self.id}:#{name}", count)
43
43
  end
44
44
  end
45
45
 
@@ -14,11 +14,11 @@ module Norton
14
14
  ts = nil
15
15
 
16
16
  Norton.redis.with do |conn|
17
- ts = conn.get("#{self.class.to_s.pluralize.downcase}:#{self.id}:#{name}").try(:to_i)
17
+ ts = conn.get("#{self.class.to_s.pluralize.underscore}:#{self.id}:#{name}").try(:to_i)
18
18
 
19
19
  if ts.nil?
20
20
  ts = Time.now.to_i
21
- conn.set("#{self.class.to_s.pluralize.downcase}:#{self.id}:#{name}", ts)
21
+ conn.set("#{self.class.to_s.pluralize.underscore}:#{self.id}:#{name}", ts)
22
22
  end
23
23
 
24
24
  ts
@@ -28,9 +28,9 @@ module Norton
28
28
  define_method("touch_#{name}") do
29
29
  Norton.redis.with do |conn|
30
30
  if options[:digits].present? && options[:digits] == 13
31
- conn.set("#{self.class.to_s.pluralize.downcase}:#{self.id}:#{name}", (Time.now.to_f * 1000).to_i)
31
+ conn.set("#{self.class.to_s.pluralize.underscore}:#{self.id}:#{name}", (Time.now.to_f * 1000).to_i)
32
32
  else
33
- conn.set("#{self.class.to_s.pluralize.downcase}:#{self.id}:#{name}", Time.now.to_i)
33
+ conn.set("#{self.class.to_s.pluralize.underscore}:#{self.id}:#{name}", Time.now.to_i)
34
34
  end
35
35
  end
36
36
  end
@@ -1,3 +1,3 @@
1
1
  module Norton
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Larry Zhao