Module: Librarian::Helpers

Extended by:
Helpers
Included in:
Helpers
Defined in:
lib/librarian/helpers.rb

Instance Method Summary collapse

Instance Method Details

#strip_heredoc(string) ⇒ Object

active_support/core_ext/string/strip


6
7
8
9
10
# File 'lib/librarian/helpers.rb', line 6

def strip_heredoc(string)
  indent = string.scan(/^[ \t]*(?=\S)/).min
  indent = indent.respond_to?(:size) ? indent.size : 0
  string.gsub(/^[ \t]{#{indent}}/, '')
end