safe_callbacks 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/safe_callbacks.rb +11 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTdjZjFiNDRiZDgzNTA0NzFmYWUwZTI3NjE5ZmRkOGNjZTAzMGQ2Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzY1Y2NmNzc5NTY2ZTJlODQ2Y2ZkNzYwYmMwMzI0YjhlYjgwYWExMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWJlNDFlZTRlNDk4NWE1OTAzMWY4N2UwMjU0NzU5NmExNjRkOTRlMjRiZmVk
|
10
|
+
M2Y2YmQ4Y2U3NmI0ZTY5NTZmNTU3NjA5MTViOWMxNTE4YmQzZDc5YjQ3OWFh
|
11
|
+
YjExOGJjNjU0OWVkMmIwM2UwY2ZlMjllYzliZTlmMzZiOWEwZmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDM2ODhhZmYyMTJjMDI1MjBlYTQwZTI2OTFmOTU0Yjg0MGRjZTZmZGJkMGFh
|
14
|
+
OTg0MWYzNDc4NTk4MTY0NWQ2NGUyMTdhMGE4NzE4YmUxMDM1Zjg2NTYyZmEy
|
15
|
+
NDE3YzBkNzQ3MWI3NjVlM2QwMTFmZTc5NDVjOGQxNjkyZjM3YWM=
|
data/lib/safe_callbacks.rb
CHANGED
@@ -14,6 +14,10 @@ module SafeCallbacks
|
|
14
14
|
]
|
15
15
|
|
16
16
|
class << self
|
17
|
+
def extend_mongo_mapper!
|
18
|
+
MongoMapper::Document.extend SafeCallbacks::MongoMapperExtension
|
19
|
+
end
|
20
|
+
|
17
21
|
def extended(mod)
|
18
22
|
SafeCallbacks::CALLBACK_METHODS.each do |callback_method_name|
|
19
23
|
unsafe_callback_method_name = :"unsafe_#{callback_method_name}"
|
@@ -33,6 +37,13 @@ module SafeCallbacks
|
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
40
|
+
module MongoMapperExtension
|
41
|
+
def included(mod)
|
42
|
+
super
|
43
|
+
mod.extend SafeCallbacks
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
36
47
|
module ClassMethods
|
37
48
|
CALLBACK_METHODS.each do |callback_method_name|
|
38
49
|
define_method callback_method_name do |method_name, options={}|
|