2 Matching Annotations
- Nov 2022
-
github.com github.com
-
def with_something prepare yield on_success end any return, break or throw would skip the on_success code. Skipping over the on_success code also seems quite reasonable when the block calls break and throw. It may not seem like the obvious behaviour for return, but perhaps it is a safe assumption to make in general to think of return as aborting the method yielding to the block. It might be desirable to discourage the use of return in this way for transactions to keep the code clearer, but that would also affect the use of break which seems like a reasonable way to abort a transaction from within the transaction block.
-
-
stackoverflow.com stackoverflow.com
-
If you're nested inside several blocks and can't use next, rather extract the contents of the transaction into its own method and use return there.
-