esse-jbuilder 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/ci/Gemfile.rails-5.2.lock +1 -1
- data/lib/esse/jbuilder/version.rb +1 -1
- data/lib/esse/jbuilder/view_template.rb +6 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0329554a1adfbaa16fa2050f6d6eab3b72f58fcd3eb9997bd2deaf3ff2bf60c5'
|
4
|
+
data.tar.gz: f68ce58c54b66d87f35200ef43bdbdaf4aec32a7bbc527f3d7a5d446171250f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0e9e74eb4f301b3fa8fd40802c32f770ab9f90d9bde6766e923efaf5679663bbf36fe2a5e1e5f0698ca88515371142b8340a035df9cf812c03a71bb4b50db8a
|
7
|
+
data.tar.gz: f0e328c4db4c1d1cf05d190d9abf45b821388036dbaadce57b7d279bdffb12e50aef92abf365f197f2852a1db995db2d7ca7ba1c13a2a9ed5e5a109a33616c70
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 0.0.2 - 2023-11-27
|
8
|
+
* Esse::Jbuilder::ViewTemplate.call returns a hash with symbolized keys.
|
9
|
+
|
7
10
|
## 0.0.1 - 2023-11-27
|
8
11
|
The first release of the esse-jbuilder plugin
|
9
12
|
* Added the `Esse::Jbuilder::Template` class to render a template block.
|
data/Gemfile.lock
CHANGED
data/ci/Gemfile.rails-5.2.lock
CHANGED
@@ -17,21 +17,22 @@ module Esse
|
|
17
17
|
class ViewTemplate
|
18
18
|
attr_reader :view_filename, :assigns
|
19
19
|
|
20
|
-
def self.call(view_filename,
|
21
|
-
new(view_filename,
|
20
|
+
def self.call(view_filename, assigns = {})
|
21
|
+
new(view_filename, assigns).to_hash
|
22
22
|
end
|
23
23
|
|
24
|
-
def initialize(view_filename,
|
24
|
+
def initialize(view_filename, assigns = {})
|
25
25
|
@view_filename = view_filename
|
26
|
-
@assigns = assigns
|
26
|
+
@assigns = assigns.transform_keys(&:to_sym)
|
27
27
|
end
|
28
28
|
|
29
29
|
def to_hash
|
30
30
|
lookup_context = ::ActionView::LookupContext.new(Esse.config.search_view_path)
|
31
31
|
view = ActionView::Base.new(lookup_context, assigns, nil, %i[json])
|
32
|
-
JbuilderTemplate.new(view) do |json|
|
32
|
+
hash = JbuilderTemplate.new(view) do |json|
|
33
33
|
json._render_template! view_filename
|
34
34
|
end.attributes!
|
35
|
+
Esse::HashUtils.deep_transform_keys(hash, &:to_sym)
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|