module Roda::RodaPlugins::ContentFor::InstanceMethods
def content_for(key, value=nil, &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, value=nil, &block) append = opts[:append_content_for] if block || value if block outvar = render_opts[:template_opts][:outvar] buf_was = instance_variable_get(outvar) # Use temporary output buffer for ERB-based rendering systems instance_variable_set(outvar, String.new) value = Tilt[render_opts[:engine]].new(&block).render instance_variable_set(outvar, buf_was) end @_content_for ||= {} if append (@_content_for[key] ||= []) << value else @_content_for[key] = value end elsif @_content_for && (value = @_content_for[key]) if append value = value.join end value end end