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

Make Module#define_method more compatible with CRuby #2593

Merged
merged 7 commits into from
Oct 26, 2023

Conversation

takaram
Copy link
Member

@takaram takaram commented Oct 1, 2023

This PR fixes several things about Module#define_method.

  • Methods defined by define_method with UnboundMethod accept a block
  • define_method tries to convert the first argument to String using to_str
    • Module#remove_method and Module#undef_method share the same logic
  • define_method ignores the block when the second argument is passed
  • define_method raises TypeError if the passed method's owner is the receiver's child or unrelated class

@hmdne hmdne linked an issue Oct 19, 2023 that may be closed by this pull request
@hmdne hmdne added this to the v1.8 milestone Oct 19, 2023
Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@hmdne hmdne merged commit c4eac88 into opal:master Oct 26, 2023
20 checks passed
@takaram takaram deleted the define_method branch October 26, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants