From: "brueckenschlaeger23 (Micha J)" Date: 2012-11-01T22:23:22+09:00 Subject: [ruby-core:48704] [ruby-trunk - Bug #7255] Ripper inside class_eval ommits :string_content between new line and :string_embexpr Issue #7255 has been updated by brueckenschlaeger23 (Micha J). I noticed, that this bug reaches a bit wider: 'class_eval <<-RUBY, __FILE__, __LINE__+1 def #{parent}_contents(*args) test = "" test ||= "#{parent}" end RUBY ' ' test ||= "' also is omitted by ripper. This is the string between the "\n" of [:@tstring_content, "_contents(*args)\n test = \"\"\n", [3, 21]]] the next embed. ---------------------------------------- Bug #7255: Ripper inside class_eval ommits :string_content between new line and :string_embexpr https://bugs.ruby-lang.org/issues/7255#change-32164 Author: brueckenschlaeger23 (Micha J) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: 1.9.3p286 See the following Code parsed by Ripper using content = 'class_eval <<-RUBY, __FILE__, __LINE__+1 def #{parent}contents(*args) "" end RUBY ' Ripper::SexpBuilder.new(content).parse The resulting sexp ommits truncates the first string_add to " \n" instead of " \n def " - - :string_literal - - :string_add - - :string_add - - :string_add - - :string_content - - :@tstring_content - " \n" - - 2 - 0 If you remove the empty line, it works fine and the " def " is part of the string. As well it works without any embed #{}. -- http://bugs.ruby-lang.org/