renz45 / mandrill_mailer

A small gem for sending Mandrill template emails
260 stars 84 forks source link

Suggestion: Interceptor should accept return from proc #118

Closed chrisbloom7 closed 6 years ago

chrisbloom7 commented 8 years ago

Currently the interceptor expects the params argument to be modified in place inside the proc. Doing something as innocuous as params = params.with_indifferent_access means the rest of the proc is working on a clone of the params object and thus any changes are not preserved for the rest of the API operation. I was expecting that simply returning params at the end would work, but it does not. Nor does assigning back to params. Changing the interceptor to allow a return value would allow for much more complex proc blocks, such as instantiating a class, working on a copy of the params hash, and then returning the sanitized object.

renz45 commented 8 years ago

Hi Chris, Good point, I have no problem with changing interceptors to work this way as long as we can find a way to preserve current usage (or else we'll need to bump a major most likely). I probably don't have much time to do anything with this gem for another month or so, I'm pretty swamped leading a project at work until then. If you wanted to submit a PR I could offer advice and I'd be willing to merge it and release a new version.

renz45 commented 6 years ago

Closing as stale, feel free to reopen if this is still pressing. 😄 ❤️