github/scientist ? reverse-engineered prompt

Reverse engineered prompt

Build me a Ruby gem for safely refactoring risky code paths in a Rails or Ruby app.

I want a small library where I can wrap my old logic in a control block and my new logic in a candidate block, then run both and always return the control result. It should be easy to use with a simple helper like science, but also let me build custom experiment classes when I need more control.

Please include the main things people would expect, like turning experiments on and off, comparing control and candidate results, handling errors, adding context, cleaning values before publishing, and running setup only when the experiment actually runs. It should also support swapping in my own publisher so I can log or send results somewhere.

Keep it clean, well documented, and tested. If you need to check current Ruby best practices or docs while implementing it, go ahead and look them up online.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab