class Erubi::CaptureBlockEngine
This engine does not support the :chain_appends option, and ignores it if present.
use a subclass of CaptureBlockEngine::Buffer and override the #| method.
This engine does not support the :escapefunc option. To change the escaping function,
CaptureBlockEngine::Buffer class.
This requires using a string subclass as the buffer value, provided by the
</form>
FOO
<form>
With output being:
end
“<form>#{@bufvar.capture(&block).upcase}</form>”
def upcase_form(&block)
Where upcase_form
is defined like:
<% end %>
<%= ‘foo’ %>
<%= upcase_form do %>
An engine class that supports capturing blocks via the <%=
and <%==
tags:
def add_expression_op(op, code)
def add_expression_op(op, code) check = /\A\s*\z/.send(MATCH_METHOD, code) ? "''" : '' with_buffer{@src << op << check << code} end
def add_expression_result(code)
def add_expression_result(code) add_expression_op(' <<= ', code) end
def add_expression_result_escaped(code)
def add_expression_result_escaped(code) add_expression_op(' |= ', code) end
def initialize(input, properties={})
def initialize(input, properties={}) properties = Hash[properties] properties[:bufval] ||= '::Erubi::CaptureBlockEngine::Buffer.new' properties[:chain_appends] = false super end