On Mon, Oct 3, 2011 at 9:27 AM, Nikolai Weibull <now / bitwi.se> wrote:

> Why not implement it by checking the amount of leading whitespace on
> the first line and strip that amount of whitespace from all subsequent
> lines? String#margin should in that case also take an optional
> Integer argument that states how many characters to strip from the
> start of each line that is used instead of the heuristic method.

Sure, I think that's #tabto. A very useful method.

#margin, otoh, was written specifically to emulate the literal notation.

I'm working on a blog post on the topic:
http://trans.github.com/string/ruby/2011/10/02/string-iou.html
I'm going to write up a post for each of the suggestions I made, to
help explain them a little better.