module Roda::RodaPlugins::Part

  1. lib/roda/plugins/part.rb

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+).

Methods

Public Class

  1. load_dependencies

Public Class methods

load_dependencies(app)
[show source]
   # File lib/roda/plugins/part.rb
24 def self.load_dependencies(app)
25   app.plugin :render
26 end