nomo 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/nomo/model.rb +29 -11
  2. data/lib/nomo/version.rb +1 -1
  3. metadata +6 -6
data/lib/nomo/model.rb CHANGED
@@ -17,12 +17,18 @@ module Nomo
17
17
  page.modify
18
18
  end
19
19
 
20
- after_save modify_page_method
21
- after_touch modify_page_method
22
- after_destroy modify_page_method
20
+ if !options[:callbacks] || options[:callbacks] == true
21
+ after_save modify_page_method
22
+ after_touch modify_page_method
23
+ after_destroy modify_page_method
24
+ elsif options[:callbacks].is_a?(Array)
25
+ after_save modify_page_method if options[:callbacks].include?(:save)
26
+ after_touch modify_page_method if options[:callbacks].include?(:touch)
27
+ after_destroy modify_page_method if options[:callbacks].include?(:destroy)
28
+ end
23
29
  end
24
30
 
25
- def modifies_page(association, name)
31
+ def modifies_page(association, name, options = {})
26
32
  association_page_method = :"#{association}_#{name}_page"
27
33
  modify_association_page_method = :"modify_#{association}_#{name}_page"
28
34
 
@@ -35,12 +41,18 @@ module Nomo
35
41
  page.modify
36
42
  end
37
43
 
38
- after_save modify_association_page_method
39
- after_touch modify_association_page_method
40
- after_destroy modify_association_page_method
44
+ if !options[:callbacks] || options[:callbacks] == true
45
+ after_save modify_association_page_method
46
+ after_touch modify_association_page_method
47
+ after_destroy modify_association_page_method
48
+ elsif options[:callbacks].is_a?(Array)
49
+ after_save modify_association_page_method if options[:callbacks].include?(:save)
50
+ after_touch modify_association_page_method if options[:callbacks].include?(:touch)
51
+ after_destroy modify_association_page_method if options[:callbacks].include?(:destroy)
52
+ end
41
53
  end
42
54
 
43
- def modifies_pages(association, name)
55
+ def modifies_pages(association, name, options = {})
44
56
  modify_association_pages_method = :"modify_#{association}_#{name}_pages"
45
57
 
46
58
  define_method modify_association_pages_method do
@@ -51,9 +63,15 @@ module Nomo
51
63
  end
52
64
  end
53
65
 
54
- after_save modify_association_pages_method
55
- after_touch modify_association_pages_method
56
- after_destroy modify_association_pages_method
66
+ if !options[:callbacks] || options[:callbacks] == true
67
+ after_save modify_association_pages_method
68
+ after_touch modify_association_pages_method
69
+ after_destroy modify_association_pages_method
70
+ elsif options[:callbacks].is_a?(Array)
71
+ after_save modify_association_pages_method if options[:callbacks].include?(:save)
72
+ after_touch modify_association_pages_method if options[:callbacks].include?(:touch)
73
+ after_destroy modify_association_pages_method if options[:callbacks].include?(:destroy)
74
+ end
57
75
  end
58
76
  end
59
77
  end
data/lib/nomo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nomo
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  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.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &70273680893200 !ruby/object:Gem::Requirement
16
+ requirement: &70104503218260 !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: *70273680893200
24
+ version_requirements: *70104503218260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redis-namespace
27
- requirement: &70273680889240 !ruby/object:Gem::Requirement
27
+ requirement: &70104503216800 !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: *70273680889240
35
+ version_requirements: *70104503216800
36
36
  description: 304 Not Modified Headers made easy.
37
37
  email:
38
38
  - sausman@stackd.com