lib/roda/plugins/dry_view.rb in dry-web-roda-0.11.0 vs lib/roda/plugins/dry_view.rb in dry-web-roda-0.12.0
- old
+ new
@@ -1,15 +1,17 @@
+# frozen_string_literal: true
+
class Roda
module RodaPlugins
module DryView
def self.load_dependencies(app)
app.plugin :flow
end
module InstanceMethods
def view_context
- self.class["view.context"].with(view_context_options)
+ self.class["view_context"].with(view_context_options)
end
def view_context_options
{}
end
@@ -19,11 +21,12 @@
end
end
module RequestMethods
def view(name, options = {})
- options = {context: scope.view_context}.merge(options)
- on to: scope.view_key(name), call_with: [options]
+ resolve(scope.view_key(name)) do |renderer|
+ renderer.call({ context: scope.view_context }.merge(options)).to_s
+ end
end
end
end
register_plugin :dry_view, DryView