free_mutant/spec/support/compress_helper.rb
2012-08-16 18:02:03 +02:00

10 lines
239 B
Ruby

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