As an long time shell hacker, one of the most difficult things about Ruby is remembering that it’s do…end not do…done.
in the shell: for i in * do … done
in Ruby: while cond do … end
The other thing to remember is that Ruby doesn’t have a post-test loop. Combine the begin…end construct with while/until instead:
begin … end while cond
begin … end until cond