Module: Merb::Template::Erubis::Mixin

Defined in:
lib/merb-core/controller/template.rb

Instance Method Summary collapse

Instance Method Details

#capture_erb(*args, &block) ⇒ Object

Parameters

*args

Arguments to pass to the block.

&block

The template block to call.

Returns

String

The output of the block.

Examples

Capture being used in a .html.erb page:

<% @foo = capture do %>
  <p>Some Foo content!</p> 
<% end %>


185
186
187
188
189
190
191
# File 'lib/merb-core/controller/template.rb', line 185

def capture_erb(*args, &block)
  _old_buf, @_erb_buf = @_erb_buf, ""
  block.call(*args)
  ret = @_erb_buf
  @_erb_buf = _old_buf
  ret
end

#concat_erb(string, binding) ⇒ Object

DOC



194
195
196
# File 'lib/merb-core/controller/template.rb', line 194

def concat_erb(string, binding)
  @_erb_buf << string
end