Actions
Bug #11746
closedRDoc incorrect example call method on heredoc
Description
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
Updated by manuel (Jose Manuel Garcia) almost 8 years ago
- Assignee set to manuel (Jose Manuel Garcia)
Updated by manuel (Jose Manuel Garcia) almost 8 years ago
- Assignee deleted (
manuel (Jose Manuel Garcia))
Updated by ko1 (Koichi Sasada) almost 8 years ago
- Assignee set to zzak (Zak Scott)
Updated by avit (Andrew Vit) over 7 years ago
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)
Updated by hsbt (Hiroshi SHIBATA) over 4 years ago
- Status changed from Open to Assigned
- Assignee changed from zzak (Zak Scott) to aycabta (aycabta .)
Updated by jeremyevans0 (Jeremy Evans) about 4 years ago
- Status changed from Assigned to Closed
It looks like this issue has been resolved in the current version of RDoc (see https://docs.ruby-lang.org/en/trunk/syntax/literals_rdoc.html).
Actions
Like0
Like0Like0Like0Like0Like0Like0