I have a gem installed but require 'gemname' does not work. Why?

前端 未结 11 1794
傲寒
傲寒 2020-12-14 00:02

The question I\'m really asking is why require does not take the name of the gem. Also, In the case that it doesn\'t, what\'s the easiest way to find the secret incantation

11条回答
  •  执笔经年
    2020-12-14 00:16

    You need to include "rubygems" only if you installed the gem using gem . Otherwise , the secret incantation would be to fire up irb and try different combinations . Also , you can pass the -I option to the ruby interpreter so that you include the instalation directory of the gem , in the LOAD_PATH . Note that $LOAD_PATH is an array , which means you can add directories to it from within your script.

提交回复
热议问题