lib/cucumber/ast/py_string.rb in cucumber-0.6.3 vs lib/cucumber/ast/py_string.rb in cucumber-0.6.4

- old
+ new

@@ -27,10 +27,14 @@ @start_line, @end_line = start_line, end_line @string, @quotes_indent = string.gsub(/\\"/, '"'), quotes_indent end def to_s - @string.indent(-@quotes_indent) + # Assume all whitespace before the first triple quote is the same. + # Also assume the contents of the pystring is indented with the same prefix. + # This allows indentation with both " " and "\t" characters. + return @string if @quotes_indent == "" + @string.gsub(/^#{@quotes_indent[0..0]}{0,#{@quotes_indent.length}}/, "") end def accept(visitor) return if Cucumber.wants_to_quit visitor.visit_py_string(to_s)