VIM syntax coloring files for Ruby [FIX]

Henry,

I have noticed that VIM cannot properly color the
following construct in Ruby:

module MyModule
  def my_method
    foo = [ [ 1, 2 ], [3, 4], [5, 6] ]
    until foo.empty?
      foo.shift.each do |element|
        puts element
      end # colored to match until
    end # colored to match def
  end # colored to match module
end # not colorized

In the syntax/ruby.vim file, the line after the
comment "statement with optional *do*", the
statements here exclude rubyDoBlocks and
rubyCurlyBlocks from containment. I'm not
entirely sure why it was set up this way. If I
change the ruby.vim file to remove this exclusion,
it still can't properly handle this construct:

module MyModule
  def my_method
    foo = [ [ 1, 2 ], [3, 4], [5, 6] ]
    until foo.empty? do
      foo.shift.each do |element|
        puts element
      end
    end
  end
end

Does anyone familiar with vim syntax files have
any idea how to properly correct this?

    You were on the right track with removing the "rubyDoBlocks" from
the "contains" list, but the start patterns were not set up to exclude
the optional "do". Replace the line with this line to fix it (I've
broken the line down for sendmail, rebuild it into one line):

syn region rubyOptDoBlock
  matchgroup=rubyControl
  start="\<for\>"
  start="^\s*\(while\|until\)\>\(.*\<do\s*$\)\@!"
  start=";\s*\(while\|until\)\>\(.*\<do\s*$\)\@!"hs=s+1
  end="\<end\>"
  contains=ALLBUT,rubyExprSubst,rubyTodo,rubyCurlyBlock
  fold

    I hope this helps.

    - Warren Brown