free_mutant/spec/support/compress_helper.rb

11 lines
246 B
Ruby
Raw Normal View History

# encoding: utf-8
2012-08-16 12:02:03 -04:00
module CompressHelper
def strip_indent(string)
lines = string.lines
match = /\A( *)/.match(lines.first)
2012-08-16 12:02:03 -04:00
whitespaces = match[1].to_s.length
lines.map { |line| line[whitespaces..-1] }.join
2012-08-16 12:02:03 -04:00
end
end