diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-15 09:28:50 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-15 09:28:50 -0700 |
commit | d10cadca0cda894ce4536a3b9d9367bc6f5d9b0e (patch) | |
tree | 627a47804ba2d32b23e1d1d093c79f87b5b74a77 /activesupport/lib | |
parent | d433436271c5270021648a44fcf7467843d9a25f (diff) | |
download | rails-d10cadca0cda894ce4536a3b9d9367bc6f5d9b0e.tar.gz rails-d10cadca0cda894ce4536a3b9d9367bc6f5d9b0e.tar.bz2 rails-d10cadca0cda894ce4536a3b9d9367bc6f5d9b0e.zip |
simplify the condions lambda generation
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 1ba6d85b95..6f89b16d36 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -463,18 +463,8 @@ module ActiveSupport end def conditions_lambdas - conditions = [] - - unless options[:if].empty? - lambdas = Array(options[:if]).map { |c| make_lambda c } - conditions.concat lambdas - end - - unless options[:unless].empty? - lambdas = Array(options[:unless]).map { |c| make_lambda c } - conditions.concat lambdas.map { |l| invert_lambda l } - end - conditions + Array(options[:if]).map { |c| make_lambda c } + + Array(options[:unless]).map { |c| invert_lambda make_lambda c } end def _normalize_legacy_filter(kind, filter) |