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:
parent
4edb497676
commit
8a72e7e6fd
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue