Created
March 13, 2016 17:48
-
-
Save darrencauthon/e9c9697b7cb555f39ffb to your computer and use it in GitHub Desktop.
Loading a gem via IRB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/banzsolt/wargaming_api/ | |
wargaming_api git:(master) bundle exec irb | |
2.0.0-p647 :001 > WargamingApi::Accounts | |
NameError: uninitialized constant WargamingApi::Accounts | |
from (irb):1 | |
from /Users/darrencauthon/.rvm/rubies/ruby-2.0.0-p647/bin/irb:12:in `<main>' | |
2.0.0-p647 :002 > require_relative 'lib/wargaming_api' | |
accounts -> Players loaded. | |
accounts loaded. | |
=> true | |
2.0.0-p647 :003 > WargamingApi::Accounts | |
=> WargamingApi::Accounts | |
2.0.0-p647 :004 > |
I see now.
So the way to fix this is to run: require_relative 'lib/wargaming_api'
every time when I am debugging?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you run:
It's no different than running
irb
alone... except that bundler will load all of the gems in your Gemfile.But what about the most important gem of all, the one you are working on?
Well, bundler won't load that, but if you organize your gem code properly you'll be able to include all of the files in your gem with one single
require
orrequire_relative
call. That file is the the single ruby file in the/lib
folder.