controller_filter_logging 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README +3 -2
- data/lib/controller_filter_logging.rb +7 -5
- data/lib/controller_filter_logging/version.rb +1 -1
- metadata +4 -4
data/README
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module AbstractController::Callbacks::ClassMethods
|
2
|
-
def before_filter_with_logging(
|
2
|
+
def before_filter_with_logging(*args, &block)
|
3
3
|
if block_given?
|
4
4
|
Rails.logger.debug("Can't log filters with blocks: #{caller[0..3].join("\n")}")
|
5
|
-
before_filter_without_logging
|
5
|
+
before_filter_without_logging *args, &block
|
6
6
|
else
|
7
|
-
|
8
|
-
before_filter_without_logging
|
7
|
+
filter_name = args.shift
|
8
|
+
before_filter_without_logging create_logging_filter(filter_name), *args
|
9
9
|
end
|
10
10
|
end
|
11
11
|
alias_method_chain :before_filter, :logging
|
@@ -27,7 +27,8 @@ module AbstractController::Callbacks::ClassMethods
|
|
27
27
|
alias_method_chain :prepend_before_filter, :logging
|
28
28
|
|
29
29
|
def create_logging_filter(filter_name)
|
30
|
-
|
30
|
+
name = "#{filter_name.to_s.gsub(%r{[?!]}, '')}_with_logging"
|
31
|
+
define_method(name) do
|
31
32
|
Rails.logger.debug("Entering before_filter: #{filter_name}")
|
32
33
|
send(filter_name).tap do |result|
|
33
34
|
begin
|
@@ -37,5 +38,6 @@ module AbstractController::Callbacks::ClassMethods
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
41
|
+
name.to_sym
|
40
42
|
end
|
41
43
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: controller_filter_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jon Moses
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-25 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|