Last active
March 26, 2020 18:55
-
-
Save mctaylorpants/da01d6cbf0cbda3aefdb26f70dda2f05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deprecated_false_terminator # :nodoc: | |
Proc.new do |target, result_lambda| | |
terminate = true | |
catch(:abort) do | |
result = result_lambda.call if result_lambda.is_a?(Proc) | |
if Callbacks.halt_and_display_warning_on_return_false && result == false | |
display_deprecation_warning_for_false_terminator | |
else | |
terminate = false | |
end | |
end | |
terminate | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally from https://github.com/rails/rails/blob/c4d3e202e10ae627b3b9c34498afb45450652421/activesupport/lib/active_support/callbacks.rb#L766-L779