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 CHANGED
@@ -10,5 +10,6 @@ Rails 2 had this, and Rails 3 doesn't. It's super helpful when your app starts
10
10
 
11
11
  == Credits
12
12
 
13
- MINE ALL MINE
14
- jon@burningbush.us
13
+ Jon Moses <jon@burningbush.us> / github.com/jmoses
14
+ John Bintz / github.com/johnbintz
15
+
@@ -1,11 +1,11 @@
1
1
  module AbstractController::Callbacks::ClassMethods
2
- def before_filter_with_logging(filter_name, *args, &block)
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 filter_name, *args, &block
5
+ before_filter_without_logging *args, &block
6
6
  else
7
- create_logging_filter(filter_name)
8
- before_filter_without_logging "#{filter_name}_with_logging".to_sym, *args
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
- define_method("#{filter_name}_with_logging") do
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
@@ -1,3 +1,3 @@
1
1
  module ControllerFilterLogging
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
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-24 00:00:00 -04:00
18
+ date: 2011-05-25 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21