Method: String#strip_heredoc
- Defined in:
- lib/rhc/core_ext.rb
#strip_heredoc ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/rhc/core_ext.rb', line 57 def strip_heredoc indent = scan(/^[ \t]*(?=\S)/).min.size || 0 gsub(/^[ \t]{#{indent}}/, ''). gsub(/(\b|\S)[^\S\n]*\n(\S)/m, '\1 \2'). gsub(/\n+\Z/, ''). gsub(/\n{3,}/, "\n\n") end |