jb 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -1
- data/.gitignore +1 -0
- data/lib/jb/action_view_monkeys.rb +10 -7
- data/lib/jb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8532f278227b3fc1282898874bf192c8ccf72d8fd3c1d40f1fb4d2751c1894f
|
4
|
+
data.tar.gz: 395b638d4565433fa519951b12a906f32448d7c4a35a531f099679e0ed643366
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a1e9e60aee2347cc897ec6ec10061faf4b008b840dc6c95de373ca3d3ec1544853487c0be54b2a2777713dbff5b15a4fc35af04d25d106f6ba908db896af09c
|
7
|
+
data.tar.gz: c696aacf1ed03636f984980ab60a5a5b53eab6d4c54ad0562392daae1e32dc82464a59073e57c6061414634e6c49a8250787cda15c90be90dce7395e91a699f4
|
data/.github/workflows/main.yml
CHANGED
data/.gitignore
CHANGED
@@ -13,15 +13,18 @@ module Jb
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
# A wrapper class for template result that makes `to_s` method do nothing
|
17
|
+
class TemplateResult < SimpleDelegator
|
18
|
+
def to_s
|
19
|
+
__getobj__
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
16
23
|
# Rails 7.1+: A monkey-patch not to stringify rendered object from JB templates
|
17
|
-
module
|
24
|
+
module TemlateResultCaster
|
18
25
|
def _run(method, template, *, **)
|
19
26
|
val = super
|
20
|
-
if template.respond_to?(:handler) && (template.handler == Jb::Handler)
|
21
|
-
def val.to_s
|
22
|
-
self
|
23
|
-
end
|
24
|
-
end
|
27
|
+
val = Jb::TemplateResult.new val if template.respond_to?(:handler) && (template.handler == Jb::Handler)
|
25
28
|
val
|
26
29
|
end
|
27
30
|
end
|
@@ -58,7 +61,7 @@ module Jb
|
|
58
61
|
end
|
59
62
|
|
60
63
|
::ActionView::TemplateRenderer.prepend ::Jb::TemplateRenderer::JSONizer
|
61
|
-
::ActionView::Base.prepend ::Jb::
|
64
|
+
::ActionView::Base.prepend ::Jb::TemlateResultCaster if (ActionView::VERSION::MAJOR >= 7) && (ActionView::VERSION::MINOR >= 1)
|
62
65
|
begin
|
63
66
|
# ActionView::CollectionRenderer is a newly added class since 6.1
|
64
67
|
::ActionView::CollectionRenderer.prepend ::Jb::CollectionRendererExtension
|
data/lib/jb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|