You can properly indent heredocs by ending them with -EOF (note the dash): http://www.bitcetera.com/en/techblog/2009/07/02/heredoc-with-indent-in-ruby/