I've been using org babel to execute ruby code, works well but
- wrapping blocks with begin_src/end_src is cumbersome
- no live output - i have to wait till the whole process finishes to see output
Suppose I have this bit of text in a fundamental buffer
puts `pwd` puts RUBY_VERSION
When I press
C-c a I want this executed using ruby interpreter.
I started writing a defun for it like this:
(defun my-execute-region-with-ruby() (interactive))
I've found a package/function that does it (https://github.com/kaz-yos/eval-in-repl/blob/master/eval-in-repl-ruby.el)
but looking for a different solution or to amend the solution in that package. My issues:
1) When the ruby code block is executed, the "system ruby binary" is used, which is 99% of the time not the binary used by for example the rails project I'm working on 2) there should be a way to indicate the "cd working directory" when executing the ruby code block.
I've noticed "github.com/kaz-yos/eval-in-repl" uses a live inf-ruby buffer
for the execution. I already (always) have an inf-ruby consiole
running because I use "github.com/dgutov/robe", so was wondering how
I can tell "eval-in-repl-ruby.el" to re-use the preexisting "inf-ruby"
repl, because the robe repl already has it's
cd set correctly,
and as a result the ruby version is correct too because
'RBENV' detects the appropriate ruby version
to use by reading the "project/.ruby-version" file.