提交 59ec70dc 编写于 作者: X Xavier Noria

Merge pull request #21596 from JuanitoFatas/perf/strip-heredoc

Improve String#strip_heredoc
......@@ -20,7 +20,6 @@ class String
# Technically, it looks for the least indented non-empty line
# in the whole string, and removes that amount of leading whitespace.
def strip_heredoc
indent = scan(/^[ \t]*(?=\S)/).min.try(:size) || 0
gsub(/^[ \t]{#{indent}}/, '')
gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, ''.freeze)
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册