module Roda::RodaPlugins::EachPart

  1. lib/roda/plugins/each_part.rb

The each_part plugin adds an each_part method, which is a render_each-like method that treats all keywords as locals.

# Can replace this:
render_each(enum, :template, locals: {foo: 'bar'})

# With this:
each_part(enum, :template, foo: 'bar')

On Ruby 2.7+, the part method takes a keyword splat, so you must pass keywords and not a positional hash for the locals.

If you are using the :assume_fixed_locals render plugin option, template caching is enabled, you are using Ruby 3+, and you are freezing your Roda application, in addition to providing a simpler API, this also provides a performance improvement.

Methods

Public Class

  1. load_dependencies

Public Class methods

load_dependencies(app)
[show source]
   # File lib/roda/plugins/each_part.rb
23 def self.load_dependencies(app)
24   app.plugin :render_each
25 end