nomo 0.0.34 → 0.0.35

Sign up to get free protection for your applications and to get access to all the features.
data/lib/nomo/model.rb CHANGED
@@ -3,17 +3,17 @@ module Nomo
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  def save(*)
6
- Nomo.redis_multi
6
+ Nomo.multi
7
7
  return_value = super
8
- Nomo.redis_exec
8
+ Nomo.exec
9
9
 
10
10
  return_value
11
11
  end
12
12
 
13
13
  def destroy
14
- Nomo.redis_multi
14
+ Nomo.multi
15
15
  return_value = super
16
- Nomo.redis_exec
16
+ Nomo.exec
17
17
 
18
18
  return_value
19
19
  end
@@ -55,7 +55,7 @@ module Nomo
55
55
  modify_page_method = :"modify_#{association}_#{name}_page"
56
56
 
57
57
  define_method modify_page_method do
58
- for record in [send(association)].flatten
58
+ for record in [*send(association)]
59
59
  record.send(:"modify_#{name}_page")
60
60
  end
61
61
  end
data/lib/nomo/page.rb CHANGED
@@ -27,7 +27,7 @@ module Nomo
27
27
  @last_modified = Time.now.utc
28
28
 
29
29
  redis.set(key, last_modified.to_f)
30
- Nomo.publish_update(key) unless options[:publish].eql?(false) || !realtime?
30
+ Nomo.publish("updates", key) unless options[:publish].eql?(false) || !realtime?
31
31
  end
32
32
 
33
33
  def cache_key
@@ -49,9 +49,5 @@ module Nomo
49
49
  def redis
50
50
  Nomo.redis
51
51
  end
52
-
53
- def logger
54
- Nomo.logger
55
- end
56
52
  end
57
53
  end
data/lib/nomo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nomo
2
- VERSION = "0.0.34"
2
+ VERSION = "0.0.35"
3
3
  end
data/lib/nomo.rb CHANGED
@@ -73,40 +73,40 @@ module Nomo
73
73
  @logger || ::Rails.logger
74
74
  end
75
75
 
76
- @redis_multi_count = 0
77
- @redis_updates = []
76
+ @multi_count = 0
77
+ @updates = []
78
78
 
79
- def redis_multi
80
- if @redis_multi_count == 0
79
+ def multi
80
+ if @multi_count == 0
81
81
  Nomo.redis.multi
82
- Nomo.logger.debug("(nomo) redis.multi")
82
+ Nomo.logger.debug("(nomo) Nomo.multi")
83
83
  end
84
84
 
85
- @redis_multi_count += 1
85
+ @multi_count += 1
86
86
  end
87
87
 
88
- def redis_exec
89
- if @redis_multi_count == 1
90
- for key in @redis_updates.uniq
88
+ def exec
89
+ if @multi_count == 1
90
+ for key in @updates.uniq
91
91
  Nomo.redis.publish("updates", key)
92
- Nomo.logger.debug("(nomo) update published -- #{key} [Nomo.redis_exec]")
92
+ Nomo.logger.debug("(nomo) update published -- #{key}")
93
93
  end
94
- @redis_updates = []
94
+ @updates = []
95
95
 
96
96
  Nomo.redis.exec
97
- Nomo.logger.debug("(nomo) redis.exec")
97
+ Nomo.logger.debug("(nomo) Nomo.exec")
98
98
  end
99
99
 
100
- @redis_multi_count -= 1
100
+ @multi_count -= 1
101
101
  end
102
102
 
103
- def publish_update(key)
104
- if @redis_multi_count == 0
105
- Nomo.redis.publish("updates", key)
106
- Nomo.logger.debug("(nomo) update published -- #{key} [Nomo.publish_update]")
103
+ def publish(channel, msg)
104
+ if @multi_count == 0
105
+ Nomo.redis.publish(channel, msg)
106
+ Nomo.logger.debug("(nomo) update published -- #{key}")
107
107
  else
108
- @redis_updates << key
109
- Nomo.logger.debug("(nomo) update queued -- #{key} [Nomo.publish_update]")
108
+ @updates << key
109
+ Nomo.logger.debug("(nomo) update queued -- #{key}")
110
110
  end
111
111
  end
112
112
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nomo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.34
4
+ version: 0.0.35
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &70168458396220 !ruby/object:Gem::Requirement
16
+ requirement: &70296875606200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70168458396220
24
+ version_requirements: *70296875606200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redis-namespace
27
- requirement: &70168458395800 !ruby/object:Gem::Requirement
27
+ requirement: &70296875605780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70168458395800
35
+ version_requirements: *70296875605780
36
36
  description: 304 Not Modified Headers made easy.
37
37
  email:
38
38
  - sausman@stackd.com