aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorBogdan Gusiev <agresso@gmail.com>2012-05-17 11:24:39 +0300
committerBogdan Gusiev <agresso@gmail.com>2012-05-17 11:24:39 +0300
commit8a72e7e6fda77eb76043bffd048208f7199ddfa0 (patch)
tree7b33e6e8092af0269fe03511db6958d0edbd9ff2 /activesupport/lib
parent4edb4976762dcb94c8aa2deca4dc96d498d6418a (diff)
downloadrails-8a72e7e6fda77eb76043bffd048208f7199ddfa0.tar.gz
rails-8a72e7e6fda77eb76043bffd048208f7199ddfa0.tar.bz2
rails-8a72e7e6fda77eb76043bffd048208f7199ddfa0.zip
AS::Callbacks: simplify logical statement
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/callbacks.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index 4e319b4bba..0aa3efbb63 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -310,13 +310,13 @@ module ActiveSupport
method << "value = nil"
method << "halted = false"
- callbacks = "value = yield if block_given? && !halted"
+ callbacks = "value = !halted && (!block_given? || yield)"
reverse_each do |callback|
callbacks = callback.apply(callbacks)
end
method << callbacks
- method << "halted ? false : (block_given? ? value : true)"
+ method << "value"
method.join("\n")
end