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