Inside a ruby script, how do I get the path to the ruby interpreter?
Example script:
#!/path/to/ruby
puts `#{RUBY_INTERPRETER_PATH} -e "puts 'hi'"`
#EOF
Where RUBY_INTERPRETER_PATH
is a mythical way of finding /path/to/ruby
.
This is just an example, though. I realize in this case that I could just copy /path/to/ruby
into the script, but I don't want to do that. I want this to work "correctly" regardless of what the #!
line says. Even if running under windows.
Ciao!