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.
如果我有方法
def some_method p = {} string = <<-MY_TERMINATOR Example text blah blah lorem ipsum something or another MY_TERMINATOR end
如何从 heredoc 中访问变量 p[:name]?
您可以像在普通字符串中一样进行插值
<<-TERMINATOR Example #{p[:name]} blah blah blah TERMINATOR