Module: StepSequencer::Refinements::StringStripHeredoc

Defined in:
lib/step_sequencer/refinements.rb

Overview

String#strip_heredoc


Another one from active support, this lets heredocs be indented without effecting the underlying string

Instance Method Summary collapse

Instance Method Details

#strip_heredocObject



10
11
12
13
# File 'lib/step_sequencer/refinements.rb', line 10

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