|
It was hard to understand what this method was doing, and once I got it, I
noticed it wasn't quite doing what it claimed. (It was cheating -- grabbing the
indent of the second line with text and assuming that was the least common
indent. This meant you could break it by starting a doc fragment with a line of
text, two newlines, and an indented block of example code.)
This commit replaces it with something more clear and correct, as well as some
comments explaining what we expect it to do. We also trim trailing whitespace,
while we're at it; this costs some speed, but should make it even more
reliable/useful.
We also add tests for scrub in this commit, at spec/unit/util/docs_spec.rb.
|