Issue #11746 has been updated by Andrew Vit.


This looks like a limitation in the RDoc ruby lexer. The documentation in doc/syntax/literals.rdoc looks correct.

Compare the outputs here:

```
require 'rdoc'
options = nil
ruby = [
  'expected_result = <<-EXPECTED.chomp', 
  'One plus one is #{1 + 1}', 
  'EXPECTED'
].join("\n")

puts RDoc::RubyLex.tokenize(ruby, options)
puts RDoc::RubyLex.tokenize(ruby.gsub(".chomp", ""), options)
```

----------------------------------------
Bug #11746: RDoc incorrect example call method on heredoc
https://bugs.ruby-lang.org/issues/11746#change-56569

* Author: Jose Manuel Garcia
* Status: Open
* Priority: Normal
* Assignee: Zachary Scott
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
The sample code for a call on a heredoc at http://ruby-doc.org/core-2.3.0_preview1/doc/syntax/literals_rdoc.html#label-Here+Documents
 for

**To call a method on a heredoc place it after the opening identifier:**

I think it should be 

~~~
expected_result = <<HEREDOC.chomp
One plus one is #{1 + 1}
HEREDOC
~~~
instead of

~~~
expected_result = "One plus one is #{1 + 1}
".chomp
~~~
Regards





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>