Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
return <<-HTML <li> <a href = "some-link">Link-Title</a> </li> HTML
第一行的 <<-HTML 和最后一行的 HTML 是什么?
这是一个heredoc。
http://en.wikipedia.org/wiki/Here_document#Ruby
那是这里的文件。基本上,它是一个多行字符串文字。
在<<-HTML带有HTML.
<<-HTML
HTML
为了明确回答问题,此代码段返回字符串:
<li>
<a href = "some-link">Link-Title</a>
</li>