From: Brian Candler Date: 2009-12-06T19:43:10+09:00 Subject: Re: using heredoc string in erb I wonder if you could do something along the lines of Rails' capture helper? Then you could write <%= code :brush=>"java" do %> Java code goes here <% end %> The Java code would still be subject to erb expansion though. If you're using ERb outside of Rails, you should just be able to copy what Rails does. See http://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/capture_helper.rb # The capture method allows you to extract part of a template into a # variable. You can then use this variable anywhere in your templates or layout. # # ==== Examples # The capture method can be used in ERb templates... # # <% @greeting = capture do %> # Welcome to my shiny new web page! The date and time is # <%= Time.now %> # <% end %> -- Posted via http://www.ruby-forum.com/.