lib/hanami/extensions/action.rb in hanami-2.1.0.beta2.1 vs lib/hanami/extensions/action.rb in hanami-2.1.0.rc1

- old
+ new

@@ -38,11 +38,11 @@ module InstanceMethods # @api private attr_reader :view # @api private - attr_reader :view_context + attr_reader :view_context_class # Returns the app or slice's {Hanami::Slice::RoutesHelper RoutesHelper} for use within # action instance methods. # # @return [Hanami::Slice::RoutesHelper] @@ -68,13 +68,13 @@ # # @param routes [Hanami::Slice::RoutesHelper] # # @api public # @since 2.0.0 - def initialize(view: nil, view_context: nil, rack_monitor: nil, routes: nil, **kwargs) + def initialize(view: nil, view_context_class: nil, rack_monitor: nil, routes: nil, **kwargs) @view = view - @view_context = view_context + @view_context_class = view_context_class @routes = routes @rack_monitor = rack_monitor super(**kwargs) end @@ -102,10 +102,10 @@ raise end # @api private def view_options(request, response) - {context: view_context&.with(**view_context_options(request, response))}.compact + {context: view_context_class&.new(**view_context_options(request, response))}.compact end # @api private def view_context_options(request, response) # rubocop:disable Lint:UnusedMethodArgument {request: request}