module Roda::RodaPlugins::ContentFor::InstanceMethods
def content_for(key, &block)
stored content with the given key, or return nil if there
under the given key. If called without a block, retrieve
If called with a block, store content enclosed by block
def content_for(key, &block) if block outvar = render_opts[:template_opts][:outvar] buf_was = instance_variable_get(outvar) # clean the output buffer for ERB-based rendering systems instance_variable_set(outvar, '') @_content_for ||= {} @_content_for[key] = Tilt[render_opts[:engine]].new(&block).render instance_variable_set(outvar, buf_was) elsif @_content_for @_content_for[key] end end