Module: Roda::RodaPlugins::Part
- Defined in:
- lib/roda/plugins/part.rb
Overview
The part plugin adds a part method, which is a render-like method that treats all keywords as locals.
# Can replace this:
render(:template, locals: {foo: 'bar'})
# With this:
part(: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 significant performance improvement (more significant on Ruby 3.4+).
Defined Under Namespace
Modules: AssumeFixedLocalsInstanceMethods, ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.load_dependencies(app) ⇒ Object
24 25 26 |
# File 'lib/roda/plugins/part.rb', line 24 def self.load_dependencies(app) app.plugin :render end |