rails_before_render 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/lib/rails_before_render.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8be3c2877d34be1abbd791da92a714c0a78d008e
|
4
|
+
data.tar.gz: 0000c1ee5011566838e06b9b1fb714e4fa8b6bb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c7ce7557535c8ab2dd392eeccc00a98391fad5bc4e7556746c140997a19499cc934a72e802e0c64fb044ba5fb1882fcdabff9f6e462010e88f81365301baa57
|
7
|
+
data.tar.gz: 8f551dd83a66cce9f50bc248a12d68ce4fd7bb23e5b1f7cfd45c2107d0ca63ded3ec5bb3042d945873797deffa8630e6b8b325a4dfd03825ecf0cd8c6b97e7e7
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/rails_before_render.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module RailsBeforeRender
|
2
|
-
@@
|
2
|
+
@@_before_render ||= {}
|
3
3
|
|
4
4
|
def self.included base
|
5
|
-
def base.
|
5
|
+
def base.before_render_filter &block
|
6
6
|
klass = self.to_s
|
7
|
-
@@
|
8
|
-
@@
|
7
|
+
@@_before_render[klass] ||= []
|
8
|
+
@@_before_render[klass].push block
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -17,7 +17,7 @@ module RailsBeforeRender
|
|
17
17
|
@_was_in_render = true
|
18
18
|
|
19
19
|
self.class.ancestors.each do |klass|
|
20
|
-
filters = @@
|
20
|
+
filters = @@_before_render[klass.to_s] || next
|
21
21
|
filters.each do |filter|
|
22
22
|
# do not run if render or redirect is called
|
23
23
|
instance_exec &filter unless performed?
|