Set debug breakpoints in ruby file that is read as a string and eval'd

Is it possible to customize the way the Ruby debugger identifies and locates source files? I would like to set breakpoints in ruby files that are read in as a string and parsed by ruby code using module_eval and class_eval. For example, given:

main.rb

module Calculator
# Members loaded dynamically
end

Calculator.module_eval(File.read("plugin.rb"))

plugin.rb

puts "Inside plugin.rb"

I would want to execute main.rb in the debugger and stop on a breakpoint that I set in plugin.rb. The reason 'require' isn't used instead is that in production the "files" are in-memory strings. They are only available as real files during development and debugging. I should note that in the above example I am developing and can control plugin.rb, not main.rb.

Is there any way to point the debugger to the right files, even if it requires some customization of the IDE? I'm using IntelliJ Ultimate 2021.2.1.

1 comment
Comment actions Permalink

Hello,

at the moment that kind of workflow isn't supported so could you please submit your request as a feature one on our tracker:

https://youtrack.jetbrains.com/issues/RUBY

0

Please sign in to leave a comment.