class String
def strip_heredoc
Technically, it looks for the least indented non-empty line
the user would see the usage message aligned against the left margin.
end
USAGE
...
-h This message
Supported options are:
This command does such and such.
puts <<-USAGE.strip_heredoc
if options[:usage]
For example in
Strips indentation in heredocs.
def strip_heredoc gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, "").tap do |stripped| stripped.freeze if frozen? end end