Module: Roda::RodaPlugins::Partials::InstanceMethods

Defined in:
lib/roda/plugins/partials.rb

Instance Method Summary collapse

Instance Method Details

#each_partial(enum, template, opts = OPTS) ⇒ Object

For each object in the given enumerable, render the given template (prefixing the template filename with an underscore).



42
43
44
45
46
47
48
# File 'lib/roda/plugins/partials.rb', line 42

def each_partial(enum, template, opts=OPTS)
  unless opts.has_key?(:local)
    opts = Hash[opts]
    opts[:local] = render_each_default_local(template)
  end
  render_each(enum, partial_template_name(template.to_s), opts)
end

#partial(template, opts = OPTS) ⇒ Object

Renders the given template without a layout, but prefixes the template filename to use with an underscore.



53
54
55
56
57
58
59
# File 'lib/roda/plugins/partials.rb', line 53

def partial(template, opts=OPTS)
  opts = parse_template_opts(template, opts)
  if opts[:template]
    opts[:template] = partial_template_name(opts[:template])
  end
  render_template(opts)
end