class String

Extensions to the core String class

def blank?

Returns:
  • (Boolean) - true is the string is blank, false otherwise
def blank?
  empty? || strip.empty?
end

def strip_indent

Other tags:
    Todo: - Replace call sites with squiggly heredocs when required Ruby
def strip_indent
  leading_space = scan(/^[ \t]*(?=\S)/).min
  indent = leading_space ? leading_space.size : 0
  gsub(/^[ \t]{#{indent}}/, '')
end