Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MONGOID-5673 [Monkey Patch Removal] Remove Object#do_or_do_not and Object#you_must #5713

Merged
merged 5 commits into from
Nov 8, 2023

Conversation

johnnyshields
Copy link
Contributor

@johnnyshields johnnyshields commented Sep 4, 2023

Fixes MONGOID-5673

Object#do_or_do_not and Object#you_must are kernel monkey patches which are similar to #try. Someone got cute and added Star Wars Yoda references #do_or_do_not, there is no #try.

For #do_or_do_not usages which can obviously be replaced with #try or #send I've done so. The remaining usages are localized to the Bindable module, so I've added a convenience method there which I've named #try_method.

For #you_must, I've inlined the call the if frozen?

No tests added here because the method is private and trivial.

Don't be too proud of this technological terror you've constructed.
-- Darth Vader.

Note about Future Refactoring

#try (and #try_method used here) are code smells. #try_method should be removed entirely in in the future, but at least for now it's localized to the Bindable module (far better than a monkey patch on Object.)

Overall progress is tracked here: http://tinyurl.com/mongoid-monkey. Refer to MONGOID-5660 for context.

@johnnyshields johnnyshields changed the title [Monkey Patch Removal] Remove Object#do_or_do_not and Object#you_must MONGOID-5674 [Monkey Patch Removal] Remove Object#do_or_do_not and Object#you_must Sep 4, 2023
@johnnyshields johnnyshields changed the title MONGOID-5674 [Monkey Patch Removal] Remove Object#do_or_do_not and Object#you_must MONGOID-5673 [Monkey Patch Removal] Remove Object#do_or_do_not and Object#you_must Sep 4, 2023
@jamis jamis merged commit f12e442 into mongodb:master Nov 8, 2023
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants