Tilmann Singer <[email protected]> writes: > Currently, defining classes or other constants inside a Ruby source code > block like this fails with an "unexpected class definition in method > body" error: > > #+begin_src ruby > class Three > def number = 3 > end > Three.new.number > #+end_src > > This happens because ob-ruby wraps the code in a method before evaling > it, and classes can not be defined inside methods. > > Wrapping it inside a Ruby lambda instead makes this work. The two other > options I could think of, `instance_exec` or simply a `begin ... end` > block would both break the behaviour of toplevel `return` statements in > the evaled code, which some people might rely on. The added tests ensure > that `return` still works as before.
Thanks! Applied, onto main, with amendments to the commit message. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=943ea01df I note that you do not have FSF copyright assignment, so I added TINYCHANGE cookie. I also added you to the contributor list. https://git.sr.ht/~bzg/worg/commit/f76f8b19 -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
