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