Module: Roda::RodaPlugins::EachPart
- Defined in:
- lib/roda/plugins/each_part.rb
Overview
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.
Defined Under Namespace
Modules: AssumeFixedLocalsInstanceMethods, ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.load_dependencies(app) ⇒ Object
23 24 25 |
# File 'lib/roda/plugins/each_part.rb', line 23 def self.load_dependencies(app) app.plugin :render_each end |