Can you 'require' ruby file in irb session, automatically, on every command?

后端 未结 3 447
小鲜肉
小鲜肉 2021-01-11 17:56

I am currently editing a file, and I\'m using irb to test the api:

> require \'./file.rb\'
> o = Object.new
> o.method

I then want

3条回答
  •  礼貌的吻别
    2021-01-11 18:34

    What about require_dependency from ActiveSupport library?

    require 'active_support/dependencies' #load it at the beginning
    require_dependency 'myscript.rb'
    

    Then require_dependency should track the changes in myscript file and reload it.

提交回复
热议问题