-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update hanami-view extension to work with the 2.1 beta
`Hanami::View::Context` no longer supports `#with`, as it's encouraged for a single instance to be used for the whole request [1]. We use the same approach as hanami [2], where users can configure a default context class and it's expected to be initialized with keyword arguments. In our case, the default context class is a noop and we expect users to implement it. It can be configured in the `view_context_class` setting, while the initialize options can be created from the connection struct through a lambda configured in the `view_context_options` setting. [1] - hanami/view#223 [2] - hanami/hanami#1359
- Loading branch information
1 parent
f910ed7
commit ffecd9e
Showing
5 changed files
with
61 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
lib/web_pipe/extensions/hanami_view/hanami_view/context.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'hanami/view' | ||
|
||
module WebPipe | ||
module HanamiView | ||
# Noop context class for Hanami::View used by default. | ||
class Context < Hanami::View::Context | ||
def initialize(**_kwargs) | ||
super() | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters