Calling another ruby script from a ruby script
- by Andrew Grimm
In ruby, is it possible to specify to call another ruby script using the same ruby interpreter as the original script is being run by?
For example, if a.rb runs b.rb a couple of times, is it possible to replace
system("ruby", "b.rb", "foo", "bar")
with something like
run_ruby("b.rb", "foo", "bar")
so that if you used ruby1.9.1 a.rb on the original, ruby1.9.1 would be used on b.rb, but if you just used ruby a.rb on the original, ruby would be used on b.rb?
I'd prefer not to use shebangs, as I'd like it to be able to run on different computers, some of which don't have /usr/bin/env.