Skip to main content
replaced http://emacs.stackexchange.com/ with https://emacs.stackexchange.com/
Source Link

I have the same question as [this question][1] except that I don't see how to do so other than in elisp. I am using Ruby, but I suppose the question applies to other languages as well. If I return an array of arrays as the value result of some code, I want to have it formatted as a table headed with the column names.

Here is the solution to what I want in elisp:

#+BEGIN_SRC emacs-lisp :results value table
  '(("First" "Second")
    hline
    (a b) (c d))
#+END_SRC

#+RESULTS:
| First | Second |
|-------+--------|
| a     | b      |
| c     | d      |

But I've tried variants of this in Ruby with no luck. For example:

#+BEGIN_SRC ruby :results value table
    [ [ 'First', 'Second'],
      :hline,
      [ :a, :b ],
      [ :c, :d ]
    ]
#+END_SRC

#+RESULTS:
| (First Second) | :hline | (:a :b) | (:c :d) |

Which is not what I want. So, what is the incantation to use here? [1]: http://emacs.stackexchange.com/a/20710/10291https://emacs.stackexchange.com/a/20710/10291

I have the same question as [this question][1] except that I don't see how to do so other than in elisp. I am using Ruby, but I suppose the question applies to other languages as well. If I return an array of arrays as the value result of some code, I want to have it formatted as a table headed with the column names.

Here is the solution to what I want in elisp:

#+BEGIN_SRC emacs-lisp :results value table
  '(("First" "Second")
    hline
    (a b) (c d))
#+END_SRC

#+RESULTS:
| First | Second |
|-------+--------|
| a     | b      |
| c     | d      |

But I've tried variants of this in Ruby with no luck. For example:

#+BEGIN_SRC ruby :results value table
    [ [ 'First', 'Second'],
      :hline,
      [ :a, :b ],
      [ :c, :d ]
    ]
#+END_SRC

#+RESULTS:
| (First Second) | :hline | (:a :b) | (:c :d) |

Which is not what I want. So, what is the incantation to use here? [1]: http://emacs.stackexchange.com/a/20710/10291

I have the same question as [this question][1] except that I don't see how to do so other than in elisp. I am using Ruby, but I suppose the question applies to other languages as well. If I return an array of arrays as the value result of some code, I want to have it formatted as a table headed with the column names.

Here is the solution to what I want in elisp:

#+BEGIN_SRC emacs-lisp :results value table
  '(("First" "Second")
    hline
    (a b) (c d))
#+END_SRC

#+RESULTS:
| First | Second |
|-------+--------|
| a     | b      |
| c     | d      |

But I've tried variants of this in Ruby with no luck. For example:

#+BEGIN_SRC ruby :results value table
    [ [ 'First', 'Second'],
      :hline,
      [ :a, :b ],
      [ :c, :d ]
    ]
#+END_SRC

#+RESULTS:
| (First Second) | :hline | (:a :b) | (:c :d) |

Which is not what I want. So, what is the incantation to use here? [1]: https://emacs.stackexchange.com/a/20710/10291

Bumped by Community user
Source Link

How to return an org mode table with headings and hline from Ruby

I have the same question as [this question][1] except that I don't see how to do so other than in elisp. I am using Ruby, but I suppose the question applies to other languages as well. If I return an array of arrays as the value result of some code, I want to have it formatted as a table headed with the column names.

Here is the solution to what I want in elisp:

#+BEGIN_SRC emacs-lisp :results value table
  '(("First" "Second")
    hline
    (a b) (c d))
#+END_SRC

#+RESULTS:
| First | Second |
|-------+--------|
| a     | b      |
| c     | d      |

But I've tried variants of this in Ruby with no luck. For example:

#+BEGIN_SRC ruby :results value table
    [ [ 'First', 'Second'],
      :hline,
      [ :a, :b ],
      [ :c, :d ]
    ]
#+END_SRC

#+RESULTS:
| (First Second) | :hline | (:a :b) | (:c :d) |

Which is not what I want. So, what is the incantation to use here? [1]: http://emacs.stackexchange.com/a/20710/10291