nomo 0.0.13 → 0.0.14
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.
- data/lib/nomo/model.rb +21 -21
- data/lib/nomo/version.rb +1 -1
- metadata +5 -5
data/lib/nomo/model.rb
CHANGED
@@ -4,47 +4,47 @@ module Nomo
|
|
4
4
|
|
5
5
|
module ClassMethods
|
6
6
|
def has_page(name, options = {})
|
7
|
-
|
8
|
-
|
7
|
+
page_method = :"#{name}_page"
|
8
|
+
modify_page_method = :"modify_#{name}_page"
|
9
9
|
|
10
|
-
define_method
|
10
|
+
define_method page_method do
|
11
11
|
@nomo_pages ||= {}
|
12
12
|
@nomo_pages[name] ||= Nomo::Page.new(self, name, options)
|
13
13
|
end
|
14
14
|
|
15
|
-
define_method
|
16
|
-
page = send(
|
15
|
+
define_method modify_page_method do
|
16
|
+
page = send(page_method)
|
17
17
|
page.modify
|
18
18
|
end
|
19
19
|
|
20
|
-
after_save
|
21
|
-
after_touch
|
22
|
-
after_destroy
|
20
|
+
after_save modify_page_method
|
21
|
+
after_touch modify_page_method
|
22
|
+
after_destroy modify_page_method
|
23
23
|
end
|
24
24
|
|
25
25
|
def modifies_page(association, name)
|
26
|
-
|
27
|
-
|
26
|
+
association_page_method = :"#{association}_#{name}_page"
|
27
|
+
modify_association_page_method = :"modify_#{association}_#{name}_page"
|
28
28
|
|
29
|
-
define_method
|
29
|
+
define_method association_page_method do
|
30
30
|
@nomo_pages ||= {}
|
31
31
|
@nomo_pages["#{association}/#{name}"] ||= Nomo::Page.new({ type: association, id: send(:"#{association}_id") }, name)
|
32
32
|
end
|
33
33
|
|
34
|
-
define_method
|
35
|
-
page = send(
|
34
|
+
define_method modify_association_page_method do
|
35
|
+
page = send(association_page_method)
|
36
36
|
page.modify
|
37
37
|
end
|
38
38
|
|
39
|
-
after_save
|
40
|
-
after_touch
|
41
|
-
after_destroy
|
39
|
+
after_save modify_association_page_method
|
40
|
+
after_touch modify_association_page_method
|
41
|
+
after_destroy modify_association_page_method
|
42
42
|
end
|
43
43
|
|
44
44
|
def modifies_pages(association, name)
|
45
|
-
|
45
|
+
modify_association_pages_method = :"modify_#{association}_#{name}_pages"
|
46
46
|
|
47
|
-
define_method
|
47
|
+
define_method modify_association_pages_method do
|
48
48
|
Nomo.redis.multi do
|
49
49
|
for record in send(association)
|
50
50
|
record.send(:"modify_#{name}_page")
|
@@ -52,9 +52,9 @@ module Nomo
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
after_save
|
56
|
-
after_touch
|
57
|
-
after_destroy
|
55
|
+
after_save modify_association_pages_method
|
56
|
+
after_touch modify_association_pages_method
|
57
|
+
after_destroy modify_association_pages_method
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
data/lib/nomo/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-07-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
16
|
-
requirement: &
|
16
|
+
requirement: &70102075077160 !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: *
|
24
|
+
version_requirements: *70102075077160
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redis-namespace
|
27
|
-
requirement: &
|
27
|
+
requirement: &70102075071300 !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: *
|
35
|
+
version_requirements: *70102075071300
|
36
36
|
description: 304 Not Modified Headers made easy.
|
37
37
|
email:
|
38
38
|
- sausman@stackd.com
|