rubyirb

Is it possible to place the .irbrc file in the project folder?


I would like to place the .irbrc file in my project folder to configure the irb console just for that specific project. I am aware that i can configure .irbrc placing it in the home folder but i would like to avoid that, i just want to require all the files of my project when i get into the console, but i am not looking for a permanent behaviour I am trying to place .irbrc file in the project root but it does not seem to be requiring anything if i place it there. Is it possible to do it??. Any suggestion would be much appreciated. Thank you so much


Solution

  • Does your project have a ./bin/console file? Probably that's what you're looking for.

    Here is some information about it: Your Ruby App Should Have a bin/console.

    However, you can pass another file to be loaded in irb:

    IRBRC="~/Documents/.irbrc" irb
    

    You can look at how irb loads it in init.rb, if you're interested.