diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-18 16:54:28 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-18 16:54:28 -0700 |
commit | c6c6ffbd621f8bccfdda0431e7cc8cc5529b1c3b (patch) | |
tree | 959413dea3078d328a1b81d00f2aa34e04a957a6 | |
parent | 57d38175004f9795c35a45e20a898b1f4b41ddfc (diff) | |
download | rails-c6c6ffbd621f8bccfdda0431e7cc8cc5529b1c3b.tar.gz rails-c6c6ffbd621f8bccfdda0431e7cc8cc5529b1c3b.tar.bz2 rails-c6c6ffbd621f8bccfdda0431e7cc8cc5529b1c3b.zip |
simplify filter enabled checking
-rw-r--r-- | actionpack/lib/action_dispatch/http/parameter_filter.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/http/parameter_filter.rb b/actionpack/lib/action_dispatch/http/parameter_filter.rb index 490b46c990..4edf235717 100644 --- a/actionpack/lib/action_dispatch/http/parameter_filter.rb +++ b/actionpack/lib/action_dispatch/http/parameter_filter.rb @@ -1,26 +1,21 @@ module ActionDispatch module Http class ParameterFilter - def initialize(filters) @filters = filters end def filter(params) - if enabled? - compiled_filter.call(params) - else + if @filters.empty? params.dup + else + compiled_filter.call(params) end end private - def enabled? - @filters.present? - end - - FILTERED = '[FILTERED]'.freeze + FILTERED = '[FILTERED]' def compiled_filter @compiled_filter ||= begin |