DEV Community

Cover image for Inspect a Ruby gem in my editor
Jeremy
Jeremy

Posted on • Originally published at blog.notgrm.dev

Inspect a Ruby gem in my editor

Translated from my blog: Débugger une gem Ruby

Sometimes I may have to inspect one of my Ruby (or Rails) project dependency to debug an error, or understand how things works.

I could open my browser, go to Github.com, and look through the gem repository. But this approach required me know the version used in my project, and it does not allow me to prove that my hypothesizes are valid as I can follow the runtime only in my head.

OR

I could also use the bundle open <gem> command as it will open the downloaded dependency and open its file right in my editor. Opening my project's gem allows me edit its files and saw the changes be applied instantly, for exemple I could puts some debugging breakpoints and inspect the current runtime context of my problem to resolve it.

Once I have finished my inspection, I can use the bundle pristine <gem> command to revert any changes made to my project dependency.

Additional links

Discussion (0)