ERB Buffer plugin

Plugin details

Output buffering for Erb templates in Rails. There are many solutions out there for this, involving ERB and the capture method, but this specifically for nested (to any depth) output buffer collection.

Websitehttp://www.ahgsoftware.com/pages/erb_buffer Repositorysvn://ahgsoftware.com/erb_buffer/trunk Author Michael Cerna Tags erb, template LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install svn://ahgsoftware.com/erb_buffer/trunk
# in erb template

<% @contents = capture_buffer do %>
Buffered Content, show me later in green!
<% end %>
< span style="color: green;"><%= @contents %>< /span>


<% @contents_surface = capture_buffer do %>
	Top level goodies
	<% @contents_shallow = capture_buffer do %>
		Mid level content
		<% @contents_deep = capture_buffer do %>
			deeper deeper, i say, deepah
		<% end %>
	<% end %>
<% end %>

< h1>Contents top level< /h1>
<%= @contents_surface %>
< h1>Contents medium level< /h1>
<%= @contents_shallow %>
< h1>Contents deep level< /h1>
<%= @contents_deep %>

< h1>An odd juxstaposition< /h1>
<%= @contents_surface + @contents_deep %>

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 10 months ago