Module: Tkn2::Utils

Defined in:
lib/tkn2/utils.rb

Class Method Summary collapse

Class Method Details

.strip_heredoc(string) ⇒ Object



4
5
6
7
8
# File 'lib/tkn2/utils.rb', line 4

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