我有一个方法Embed.toggler
需要一个散列参数。用下面的代码,我试图在散列中使用heredoc。使用heredoc作为散列值
Embed.toggler({
title: <<-RUBY
#{entry['time']}
#{entry['group']['who']
#{entry['name']}
RUBY
content: content
})
不过,我发现了以下错误跟踪:
syntax error, unexpected ':', expecting tSTRING_DEND
content: content
^
can't find string "RUBY" anywhere before EOF
syntax error, unexpected end-of-input, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
title: <<-RUBY
^
我怎样才能避免收到此错误?
你的问题是什么? – sawa
@sawa我如何让给定的代码工作,并防止错误。 – maxple