Function: org-babel-ruby-initiate-session
org-babel-ruby-initiate-session is a byte-compiled function defined in
ob-ruby.el.gz.
Signature
(org-babel-ruby-initiate-session &optional SESSION PARAMS)
Documentation
Initiate a ruby session.
If there is not a current inferior-process-buffer in SESSION then create one. Return the initialized session. Session settings (:ruby header arg value) are taken from PARAMS.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ob-ruby.el.gz
(defun org-babel-ruby-initiate-session (&optional session params)
"Initiate a ruby session.
If there is not a current inferior-process-buffer in SESSION
then create one. Return the initialized session.
Session settings (`:ruby' header arg value) are taken from PARAMS."
(unless (string= session "none")
(org-require-package 'inf-ruby)
(let* ((command (cdr (or (assq :ruby params)
(assoc inf-ruby-default-implementation
inf-ruby-implementations))))
(buffer (get-buffer (format "*%s*" session)))
(new-session? (not buffer))
(session-buffer (or buffer (save-window-excursion
(run-ruby-or-pop-to-buffer
(if (functionp command)
(funcall command)
command)
(or session "ruby")
(unless session
(inf-ruby-buffer)))
(current-buffer)))))
(if (org-babel-comint-buffer-livep session-buffer)
(progn
(sit-for .25)
;; Setup machine-readable prompt: no echo, prompts matching
;; uniquely by regexp.
(when new-session?
(with-current-buffer session-buffer
(setq-local
org-babel-comint-prompt-regexp-fallback comint-prompt-regexp
comint-prompt-regexp (concat "^" org-babel-ruby-prompt))
(insert org-babel-ruby-define-prompt ";")
(insert "_org_prompt_mode=conf.prompt_mode;conf.prompt_mode=:CUSTOM;")
(insert "conf.echo=false\n")
(comint-send-input nil t)))
session-buffer)
(sit-for .5)
(org-babel-ruby-initiate-session session)))))