Complete, standalone view rendering system that gives you everything you need to write well-factored view code.
Dry::View::UndefinedConfigError
when a view is called but no paths have been configured (timriley in #130)Dry::View::Renderer::TemplateNotFoundError
to Dry::View::TemplateNotFoundError
(timriley in #130)Dry::View::UndefinedConfigError
is raised instead of Dry::View::UndefinedTemplateError
when a view is called but no template has been configured (timriley in #130)shared/
subdirectories when rendering a view's template (as opposed to partials) (timriley in #130)SystemStackError
when a view is configured with a template that cannot be found on the filesystem (timriley in #129)Dry::View#call
now returns a Dry::View::Rendered
instance, which carries both the rendered output (accessible via #to_s
or #to_str
) as well as all of the view's locals, wrapped in their view parts (accessible via #locals
or individually via #[]
) (timriley in #72)Dry::View::PartBuilder
(renamed from Dry::View::Decorator
), which resolves part classes from a namespace configured via View's part_namespace
setting. A custom part builder can be specified via a View's part_builder
setting. (timriley in #80).decorate
class-level API. Context classes are now required to inherit from Dry::View::Context
. Dry::View::Context
provides a #with
method for creating copies of itself while preserving the rendering details needed for decorated attributes to work (timriley in #89 and #91)#scope
method in templates, parts, as well as scope classes themselves. Scope classes are resolved via a View's scope_builder
setting, which defaults to an instance of Dry::View::ScopeBuilder
.inflector
setting to View, which is used by the part and scope builders to resolve classes for a given part or scope name. Defaults to Dry::Inflector.new
(timriley in #80 and #90)layout: true
option (GustavoCaso in #87)decorate: false
option (timriley in #88)#_format
method (timriley in #118)renderer_engine_mapping
setting to View, which allows an explicit engine class to be provided for the rendering of a given type of template (e.g. config.renderer_engine_mapping = {erb: Tilt::ErubiTemplate}
) (timriley in #106)Dry::View::Controller
renamed to Dry::View
(timriley in #115)Dry::View
context
setting renamed to default_context
(GustavoCaso in #86)context:
block or method parameter (timriley in #119)Part#inspect
output simplified to include only name and value (timriley in #98)Part
now achieved via a prepended module, which means it is possible to decorate an attribute provided by an instance method directly on the part class, which wasn't possible with the previous method_missing
-based approach (timriley in #110)Part
classes can be initialized with missing name:
and rendering:
values, which can be useful for unit testing Part methods that don't use any rendering facilities (timriley in #116)