<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>compile (ActionView::TemplateHandlers::ERB)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File lib/action_view/template_handlers/erb.rb, line 13</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">template</span>) <span class="ruby-identifier">src</span> = <span class="ruby-operator">::</span><span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"<% __in_erb_template=true %>#{template.source}"</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">erb_trim_mode</span>, <span class="ruby-value str">'@output_buffer'</span>).<span class="ruby-identifier">src</span> <span class="ruby-comment cmt"># Ruby 1.9 prepends an encoding to the source. However this is</span> <span class="ruby-comment cmt"># useless because you can only set an encoding on the first line</span> <span class="ruby-constant">RUBY_VERSION</span> <span class="ruby-operator">>=</span> <span class="ruby-value str">'1.9'</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/\A#coding:.*\n/</span>, <span class="ruby-value str">''</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">src</span> <span class="ruby-keyword kw">end</span></pre> </body> </html>