ruby-docx / docx

a ruby library/gem for interacting with .docx files
MIT License
431 stars 170 forks source link

Request to remove monkeypatching on Module #131

Closed pjsk-stripe closed 1 year ago

pjsk-stripe commented 1 year ago

Problem

Hi friends! This gem currently mutates Module for all ruby code that requires this gem. This monkeypatching is causing a few issues in our codebase by defining delegate on all ruby objects (well, anything that extends Module, which is most things).

It seems this monkeypatch only exists to add two separate delegate calls. Can we replace these with regular ruby methods so that this gem doesn't mutate Module at runtime?

Solution

Replace delegate calls with ruby methods which removes the necessity of the core_ext directory in this gem. I opened a PR to fix this and it was relatively straight forward, happy to make any necessary changes!

https://github.com/ruby-docx/docx/pull/130

satoryu commented 1 year ago

Thank you for opening this issue and your pull request!

andreibondarev commented 1 year ago

@satoryu Could you please cut a new gem release with this fix included? Thank you!! 🙏🏻