On 5/27/09, Roger Pack <rogerpack2005 / gmail.com> wrote:
>> If you're interested, please see:
>> http://gist.github.com/117694
>
> Could you post us a few examples of what code formatted this way looks

Oops, I should have done that when I posted before. Thanks for the reminder.

#so you can leave off the end of a method
def a
  c
  d

#or anything else that requires an end
for i in 1..10
  p i
  pp i

#else and other keywords which start a subclause
#of a statement don't cause an end if outdented at the same level
#as the if which controls them.
if a
  b
else
  c

#if you actually need an end, that's allowed too
#(if not further outdented than the line that started the statement)
result = case ARGV[0]
        when /^\d*$/
          p "That's an integer!"
        when /^[A-Za-z]*$/
          p "That's a word!"
        else
          p "That's something that's not an integer or a word..."
end if ARGV[0]

#you can explicitly end just the last scope of something deeply nested.
class A
  class B
    class C
      module D
        foo
end #actually 4 ends

> like (or must look like)? I assume it handles here documents well?

It _should_, since rubylexer does. I didn't test them explicitly. Here documents
appear like one giant string; the indentation levels of all lines
inside strings are ignored. (There might be some very obscure
here-document related bugs left in rubylexer which would bite you in
endless.rb as well, tho I can't think of any right now. Most cases
should work. Here documents are weird.)

> The italics part of that gist is somewhat hard to read :)

I do apologize. It seems ok to me... What's hard about it? (You can
always just hit the link for the raw view.)