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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4876fda971da8b7067d31ce0724bd341e29f89c9f6fb4dc3f0cf8a9aac783422
4
- data.tar.gz: 2a19e8ef649406f2e3ed2dd6e7923d877c4ecaf32bc8afc5c66c753b0a37fdfb
3
+ metadata.gz: '0329554a1adfbaa16fa2050f6d6eab3b72f58fcd3eb9997bd2deaf3ff2bf60c5'
4
+ data.tar.gz: f68ce58c54b66d87f35200ef43bdbdaf4aec32a7bbc527f3d7a5d446171250f2
5
5
  SHA512:
6
- metadata.gz: 9ff4085f2b8f84cf06829a62de34611f13530bb8961e051f53db24f5f02c3d1df028e2a4e33aa0bd2c559fbb7ce34ba4fe58c921d5e7023f9f2950fe4b66aa25
7
- data.tar.gz: e6bfab74a4a7a19e04c56569e20758308b371a4d62d67bf435cec095aa2f79c88c115195d60082ad705b6806f58e7a1f01e70a30b6e13e3e648f433f2e3cf98d
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
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- esse-jbuilder (0.0.1)
13
+ esse-jbuilder (0.0.2)
14
14
  esse (>= 0.2.4)
15
15
  jbuilder (>= 2)
16
16
 
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: ..
12
12
  specs:
13
- esse-jbuilder (0.0.1)
13
+ esse-jbuilder (0.0.2)
14
14
  esse (>= 0.2.4)
15
15
  jbuilder (>= 2)
16
16
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Esse
4
4
  module Jbuilder
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.2"
6
6
  end
7
7
  end
@@ -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, **assigns)
21
- new(view_filename, **assigns).to_hash
20
+ def self.call(view_filename, assigns = {})
21
+ new(view_filename, assigns).to_hash
22
22
  end
23
23
 
24
- def initialize(view_filename, **assigns)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esse-jbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos G. Zimmermann