From: Gavin Sinclair Date: 2004-10-03T17:10:32+09:00 Subject: Re: Feature Request: Truly Indented Here-Docs On Sunday, October 3, 2004, 1:55:51 PM, James wrote: > Ruby's here-doc syntax baffles me. I don't get the indent the end tag > feature. > string = <<-END_OF_STRING > Line one... > line two... > line three. > END_OF_STRING > That leaves all the tabs at the beginning of those lines, which then > begs the question, why did I bother to indent the end tag? > It would make a lot more sense to me if lines of a here-doc were > stripped of leading whitespace equal to the indention of the end tag. > Is there any reason this wasn't done, or isn't practical? > If not, please consider this an official request, by at least one > coder... I sympathise. What I do: require 'extensions/string' string = %{ | Line one... | line two... | line three. }.trim('|') Gavin