Hi,
Up till now I’ve just had a single .irbrc file in one directory
(gemplay) which does a require_relative to the individual files in my
gem so that when working on the gem I don’t have to uninstall and
reinstall the gem again with small changes and I’ve just been running
irb from that one directory.
I’ve recently wanted to be in a position where if I’m in any other
directory and start irb I want it to load the gem using require
‘gem_name’. I thought I’d be able to achieve that by adding a .irbrc
file to my home directory while keeping the old behaviour when starting
.irbrc from the (gemplay) directory. I get the opposite behaviour to
what I was expecting, and the documentation confirms that my
expectations were wrong:
http://ruby-doc.com/docs/ProgrammingRuby/html/irb.html
that the home directory .irbrc file has highest priority and it can’t be
overridden by the .irbrc file in the working directory.
Is there a clean workaround?, or do I need to do a check in the home
directory .irbrc file to see if there is a .irbrc file in the working
directory and load that (if that is even possible) and also to check
that the working directory is not the home directory.
Thanks
Kevin