How to debug a ruby gem?

I'm not sure if there is a better way to do, but I often do like this:

Check gem path

bundle show [gem_name]

If you are Mac user, it gets copied to your clipboard

bundle show [gem_name] | pbcopy

Open your gem directory (Vim is my editor)

vim /path/to/your/gem

Find your file and add a breakpoint or inspect variables
Don't forget "restart your rails app" to apply new code