Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/helpers/doc.rb

Instance Method Summary collapse

Instance Method Details

#strip_heredocObject

The following methods is taken from activesupport

github.com/rails/rails/blob/d66e7835bea9505f7003e5038aa19b6ea95ceea1/activesupport/lib/active_support/core_ext/string/strip.rb

All credit for this method goes to the original authors. The code is used under the MIT license.

Strips indentation by removing the amount of leading whitespace in the least indented non-empty line in the whole string



59
60
61
# File 'lib/helpers/doc.rb', line 59

def strip_heredoc
  self.gsub(/^#{self.scan(/^[ \t]*(?=\S)/).min}/, "".freeze)
end