iruby
iruby copied to clipboard
Requiring configurations and helper methods
I've tried looking through the documentation so I apologize if I've missed this somewhere.
Is the any way to include some code which gets required for all iRuby notebooks? It would be useful to be able to add some data access methods and load some secrets (like database credentials) to be available globally and not have to require them in every notebook.
Thanks!
Interesting use case. Don't think it's available as of now.
@domitry maybe we can some file called iruby_on_boot.rb which is run every time a new notebook is created? User can edit this file and keep it in some pre defined directory and iruby will run it before starting a notebook.
@v0dro Thanks for the reply. That sounds perfect to me. I'm happy to help out but wasn't sure where to start. Any thoughts on where in the code base this would go?
When IRB.setup is called, will it load any .irbrc file? That way we can satisfy the use case discussed above by putting ruby code in the config file.
Ref: https://docs.ruby-lang.org/en/master/IRB.html#module-IRB-label-Configuration+File