Last active
December 8, 2021 23:44
-
-
Save bandogora/1858c793541ac1690092965c12b09786 to your computer and use it in GitHub Desktop.
Replace all Rails instances of `.try` with `&.`
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
# .try :method -> &.method | |
find ./ -type f -exec sed -ri 's/(.try\s*:)/\&./g' {} \; | |
# .try(:method) -> &.method | |
find ./ -type f -exec sed -ri 's/(.try\(?:)([^),]*)(\))/\&.\2/g' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment