free_mutant/spec/support/compress_helper.rb
2014-08-11 14:29:32 +00:00

9 lines
258 B
Ruby

module CompressHelper
def strip_indent(string)
lines = string.lines
match = /\A( *)/.match(lines.first)
return string unless match
whitespaces = match[1].to_s.length
lines.map { |line| line[whitespaces..-1] }.join
end
end