Search code examples
ruby-on-railsrubyirb

automatically load project's environment to irb


Rails has useful command rails console, which downloads all necessary data and then we can interact with rails project in irb. Is there the same technique for Ruby project (built on Ruby language)? By this trick I can play with Ruby project in the irb without concerning about loading libraries, modules, classes, files and so on. Thanks


Solution

  • Your project should have one file which loads the environment. Assuming your project is in lib/project.rb then simply:

    $ irb -Ilib -rproject