Module: Roda::RodaPlugins::Render::InstanceMethods
- Defined in:
- lib/roda/plugins/render.rb
Instance Method Summary collapse
-
#render(template, opts = RodaPlugins::OPTS, &block) ⇒ Object
(also: #render_template)
Render the given template.
-
#render_opts ⇒ Object
Return the render options for the instance’s class.
-
#view(template, opts = RodaPlugins::OPTS) ⇒ Object
Render the given template.
Instance Method Details
#render(template, opts = RodaPlugins::OPTS, &block) ⇒ Object Also known as: render_template
Render the given template. See Render for details.
277 278 279 280 |
# File 'lib/roda/plugins/render.rb', line 277 def render(template, opts = RodaPlugins::OPTS, &block) opts = render_template_opts(template, opts) retrieve_template(opts).render((opts[:scope]||self), (opts[:locals]||RodaPlugins::OPTS), &block) end |
#render_opts ⇒ Object
Return the render options for the instance’s class. While this is not currently frozen, it may be frozen in a future version, so you should not attempt to modify it.
285 286 287 |
# File 'lib/roda/plugins/render.rb', line 285 def render_opts self.class.render_opts end |
#view(template, opts = RodaPlugins::OPTS) ⇒ Object
Render the given template. If there is a default layout for the class, take the result of the template rendering and render it inside the layout. See Render for details.
292 293 294 295 296 297 298 299 300 301 |
# File 'lib/roda/plugins/render.rb', line 292 def view(template, opts=RodaPlugins::OPTS) opts = parse_template_opts(template, opts) content = opts[:content] || render_template(opts) if layout_opts = view_layout_opts(opts) content = render_template(layout_opts){content} end content end |