module Roda::RodaPlugins::CaptureERB

  1. lib/roda/plugins/capture_erb.rb

The capture_erb plugin allows you to capture the content of a block in an ERB template, and return it as a value, instead of injecting the template block into the template output.

<% value = capture_erb do %>
  Some content here.
<% end %>

capture_erb can be used inside other methods that are called inside templates. It can be combined with the inject_erb plugin to wrap template blocks with arbitrary output and then inject the wrapped output into the template.

If the output buffer object responds to capture and is not an instance of String (e.g. when erubi/capture_block is being used as the template engine), this will call capture on the output buffer object, instead of setting the output buffer object temporarily to a new object.

Methods

Public Class

  1. load_dependencies

Public Class methods

load_dependencies(app)
[show source]
   # File lib/roda/plugins/capture_erb.rb
25 def self.load_dependencies(app)
26   app.plugin :render
27 end