summaryrefslogtreecommitdiff
path: root/lisp/ob-ruby.el
diff options
context:
space:
mode:
authorS├ębastien Delafond <sdelafond@gmail.com>2014-07-13 13:35:27 +0200
committerS├ębastien Delafond <sdelafond@gmail.com>2014-07-13 13:35:27 +0200
commite32a45ed36d6000db4b39171149072d11b77af72 (patch)
treeb5f4a7d43022c08c3298e82b3e9fc50f68be660f /lisp/ob-ruby.el
parent7697fa4daf3ec84f85711a84035d8f0224afd4e3 (diff)
Imported Upstream version 8.0.7
Diffstat (limited to 'lisp/ob-ruby.el')
-rw-r--r--lisp/ob-ruby.el55
1 files changed, 25 insertions, 30 deletions
diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el
index 54077d0..20fb418 100644
--- a/lisp/ob-ruby.el
+++ b/lisp/ob-ruby.el
@@ -1,6 +1,6 @@
;;; ob-ruby.el --- org-babel functions for ruby evaluation
-;; Copyright (C) 2009-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2013 Free Software Foundation, Inc.
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
@@ -37,9 +37,6 @@
;;; Code:
(require 'ob)
-(require 'ob-ref)
-(require 'ob-comint)
-(require 'ob-eval)
(eval-when-compile (require 'cl))
(declare-function run-ruby "ext:inf-ruby" (&optional command name))
@@ -71,7 +68,9 @@ This function is called by `org-babel-execute-src-block'."
(org-babel-ruby-evaluate
session full-body result-type result-params))))
(org-babel-reassemble-table
- result
+ (org-babel-result-cond result-params
+ result
+ (org-babel-ruby-table-or-string result))
(org-babel-pick-name (cdr (assoc :colname-names params))
(cdr (assoc :colnames params)))
(org-babel-pick-name (cdr (assoc :rowname-names params))
@@ -206,31 +205,27 @@ return the value of the last statement in BODY, as elisp."
(comint-send-input nil t)) 2)
"\n") "[\r\n]")) "\n"))
(value
- ((lambda (results)
- (if (or (member "code" result-params) (member "pp" result-params))
- results
- (org-babel-ruby-table-or-string results)))
- (let* ((tmp-file (org-babel-temp-file "ruby-"))
- (ppp (or (member "code" result-params)
- (member "pp" result-params))))
- (org-babel-comint-with-output
- (buffer org-babel-ruby-eoe-indicator t body)
- (when ppp (insert "require 'pp';") (comint-send-input nil t))
- (mapc
- (lambda (line)
- (insert (org-babel-chomp line)) (comint-send-input nil t))
- (append
- (list body)
- (if (not ppp)
- (list (format org-babel-ruby-f-write
- (org-babel-process-file-name tmp-file 'noquote)))
- (list
- "results=_" "require 'pp'" "orig_out = $stdout"
- (format org-babel-ruby-pp-f-write
- (org-babel-process-file-name tmp-file 'noquote))))
- (list org-babel-ruby-eoe-indicator)))
- (comint-send-input nil t))
- (org-babel-eval-read-file tmp-file)))))))
+ (let* ((tmp-file (org-babel-temp-file "ruby-"))
+ (ppp (or (member "code" result-params)
+ (member "pp" result-params))))
+ (org-babel-comint-with-output
+ (buffer org-babel-ruby-eoe-indicator t body)
+ (when ppp (insert "require 'pp';") (comint-send-input nil t))
+ (mapc
+ (lambda (line)
+ (insert (org-babel-chomp line)) (comint-send-input nil t))
+ (append
+ (list body)
+ (if (not ppp)
+ (list (format org-babel-ruby-f-write
+ (org-babel-process-file-name tmp-file 'noquote)))
+ (list
+ "results=_" "require 'pp'" "orig_out = $stdout"
+ (format org-babel-ruby-pp-f-write
+ (org-babel-process-file-name tmp-file 'noquote))))
+ (list org-babel-ruby-eoe-indicator)))
+ (comint-send-input nil t))
+ (org-babel-eval-read-file tmp-file))))))
(defun org-babel-ruby-read-string (string)
"Strip \\\"s from around a ruby string."