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

Remove monkey patching on Module #130

Merged
merged 2 commits into from
Mar 30, 2023

Conversation

pjsk-stripe
Copy link
Contributor

@pjsk-stripe pjsk-stripe commented Mar 29, 2023

We use this gem and one particular issue we're experiencing comes from this monkey patch which adds activesupport-like delegators directly onto Module which mutates basically everything in our codebase by nature of code inheriting Class.

It looks like this monkeypatch only exists to support two separate delegate calls supporting four separate methods.

This PR replaces those delegates with regular ol' ruby methods and allows us to delete the monkeypatch (along with 100+ lines of code)

This fixes #131

✅ Tests pass in this new configuration.

@node.at_xpath(*args)
end

def xpath(*args)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

arguments match what is expected in the docs


# TODO: Should create a docx object from this
def parent(type = '*')
@node.at_xpath("./parent::#{type}")
end

def at_xpath(*args)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

arguments match what is expected in the docs

@satoryu satoryu merged commit 2f9590f into ruby-docx:master Mar 30, 2023
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.

Request to remove monkeypatching on Module
2 participants