Added
-
Track the currently-rendering template name. (@timriley in #277)
Expose the topmost entry as
Hanami::View::Rendering#current_template_nameand the full stack as#current_template_names. Entries are the resolved path of the file actually being rendered, relative to its configuredpathsdirectory, with format/engine extensions stripped. For example,render("form")from insideposts/show.html.erbreports"posts/_form"; a layout atlayouts/app.html.erbreports"layouts/app".Convenience accessors are available as
Hanami::View::Scope#_template_name(withtemplate_nameas a convenience alias) andHanami::View::Context#current_template_name. The current template name can be used to enable such behaviors as lazy/relative key lookups for i18n view helpers.
Changed
-
BREAKING: Default to undecorated exposures. (@timriley in #274)
Decorate your exposures with the new
.decoratemethod, or thedecorate: trueoption for.expose. Default back to decorated exposures viaconfig.decorate_exposures = true. -
Cache the view's resolved configuration as a frozen
Datasnapshot (via dry-configurable's#to_data) at initialization, avoiding repeated config lookups on the rendering hot path for improved memory usage and speed. (@cllns in #276) -
Require Ruby 3.3 or newer.