Module: ForemanMaintain::CoreExt::StripHeredoc

Defined in:
lib/foreman_maintain/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#strip_heredocObject



4
5
6
7
8
9
10
11
# File 'lib/foreman_maintain/core_ext.rb', line 4

def strip_heredoc
  indent = 0
  indented_lines = scan(/^[ \t]+(?=\S)/)
  unless indented_lines.empty?
    indent = indented_lines.min.size
  end
  gsub(/^[ \t]{#{indent}}/, '')
end