Skip to content
Browse files

AS::Callbacks: simplify logical statement

  • Loading branch information...
1 parent 4edb497 commit 8a72e7e6fda77eb76043bffd048208f7199ddfa0 @bogdan bogdan committed May 17, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 activesupport/lib/active_support/callbacks.rb
View
4 activesupport/lib/active_support/callbacks.rb
@@ -310,13 +310,13 @@ def compile
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

0 comments on commit 8a72e7e

Please sign in to comment.
Something went wrong with that request. Please try again.