Project

General

Profile

Actions

Bug #5442

closed

heredoc inside Hash initialization

Added by jhej (Jonatan Hejzlar) over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
1.9.2p290 (2011-07-09 revision 32553)
Backport:
[ruby-core:40134]

Description

Shouldn't this initialization be valid?

Hash[:a,<<-EOS
some text
EOS
,:b,'other']

gives the following error
syntax error, unexpected ',', expecting ']'

Updated by shyouhei (Shyouhei Urabe) over 12 years ago

  • Status changed from Open to Rejected

That's identical to

Hash[:a, "some text\n"
,:b,'other']

and produces a same error. So it is consistent. Place the comma beforehand. i.e.

Hash[:a, <<-EOS, :b, 'other']
some text
EOS

Updated by jhej (Jonatan Hejzlar) over 12 years ago

I see, thanks

Actions

Also available in: Atom PDF

Like0
Like0Like0