1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

AS::Callbacks: simplify logical statement

This commit is contained in:
Bogdan Gusiev 2012-05-17 11:24:39 +03:00
parent 4edb497676
commit 8a72e7e6fd

View file

@ -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