Now this is a small blog post, issued in interest of the beginners. On how to open and video the code of a ruby gem you are using.

The code of a ruby gem you have installed, can be done using the bundle command.

1
bundle open <gem_name>

eg.

1
bundle open rails

Now this will open the rails gem directory in the editor you have specified for bundle. If you haven’t specified any editor for it, then it would print the following error

To open a bundled gem, set $EDITOR or $BUNDLE_EDITOR to assign an editor just use the export command

1
export EDITOR=<editor_name>

eg:

1
2
3
4
export EDITOR=submlime-text-2
export EDITOR=vim
# 2022 Update
export EDITOR=code