Module: DeepCover::Tools::StripHeredoc

Defined in:
lib/deep_cover/tools/strip_heredoc.rb

Constant Summary collapse

IMPLEMENTATION =

In-place implementation copied from active-support.

-> do
  gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, ''.freeze).tap do |stripped|
    stripped.freeze if frozen?
  end
end

Instance Method Summary collapse

Instance Method Details

#strip_heredoc(string) ⇒ Object



14
15
16
# File 'lib/deep_cover/tools/strip_heredoc.rb', line 14

def strip_heredoc(string)
  string.instance_exec(&IMPLEMENTATION)
end