jbuilder-schema 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 991bddd670414a1f167fc83b2114d27337ab2e5df0b1e6355e86cbfe832521c2
4
- data.tar.gz: ae052082eee4397d31eff6765676efe8961a0e9cccc76dd4ff468352281f27ea
3
+ metadata.gz: 2aea259ba4965ec62874b56ab4267ddc2f4cd2967babe536726397c53599c922
4
+ data.tar.gz: 71c9f200fb4cc481055ec0790e514b9a46108a6ae4cb0c0aad1ed09eba5f384e
5
5
  SHA512:
6
- metadata.gz: 68f345ca2156440ec1e98f89a9322cf92f5450006b51e61b17d7437721fbc542985142f4fd223d8cc805bed1e6b4b2d2c2bd96197b1805155a6a9af04f0f59cd
7
- data.tar.gz: 64d6feefab876b7446e4523d739b9c9be65fd88e42eec35bcbab54f417f5ff6966c6c7a898c06d506e301a26ba3e474e5282275a2f5af575dcba64f8e4032366
6
+ metadata.gz: d0ac95a76f5630daad73debfd74f6056dd3e6b4f30e4075779a41306585d211c918d16140de6f32b01a60db3303ac21e1ccdf8c52b9ea4292e32c38a134e1e21
7
+ data.tar.gz: d88181a3d13d3748cfca995bbcc9de741bb9d5ecf98bd34af452b499aaeae2c0a6c44c5fc57ea88ee3892a2b6c2579f65a3310f1b59a83805067422ea20956c3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jbuilder-schema (2.0.3)
4
+ jbuilder-schema (2.0.4)
5
5
  jbuilder
6
6
  rails (>= 5.0.0)
7
7
 
@@ -89,8 +89,11 @@ GEM
89
89
  loofah (2.19.0)
90
90
  crass (~> 1.0.2)
91
91
  nokogiri (>= 1.5.9)
92
- mail (2.7.1)
92
+ mail (2.8.0)
93
93
  mini_mime (>= 0.1.1)
94
+ net-imap
95
+ net-pop
96
+ net-smtp
94
97
  marcel (1.0.2)
95
98
  method_source (1.0.0)
96
99
  mini_mime (1.1.2)
@@ -101,7 +104,7 @@ GEM
101
104
  net-protocol
102
105
  net-pop (0.1.2)
103
106
  net-protocol
104
- net-protocol (0.1.3)
107
+ net-protocol (0.2.0)
105
108
  timeout
106
109
  net-smtp (0.3.3)
107
110
  net-protocol
@@ -112,7 +115,7 @@ GEM
112
115
  parallel (1.22.1)
113
116
  parser (3.1.2.0)
114
117
  ast (~> 2.4.1)
115
- racc (1.6.0)
118
+ racc (1.6.1)
116
119
  rack (2.2.4)
117
120
  rack-test (2.0.2)
118
121
  rack (>= 1.3)
@@ -168,7 +171,7 @@ GEM
168
171
  rubocop (= 1.32.0)
169
172
  rubocop-performance (= 1.14.3)
170
173
  thor (1.2.1)
171
- timeout (0.3.0)
174
+ timeout (0.3.1)
172
175
  tzinfo (2.0.5)
173
176
  concurrent-ruby (~> 1.0)
174
177
  unicode-display_width (2.2.0)
@@ -10,7 +10,7 @@ class Jbuilder::Schema
10
10
 
11
11
  class Handler < ::JbuilderHandler
12
12
  def self.call(template, source = nil)
13
- super.sub("JbuilderTemplate.new(self", "Jbuilder::Schema::Template.new(self, **__jbuilder_schema_options").sub("target!", "schema!")
13
+ super.sub("JbuilderTemplate.new(self", "Jbuilder::Schema::Template.build(self, local_assigns")
14
14
  end
15
15
  end
16
16
 
@@ -18,6 +18,14 @@ class Jbuilder::Schema
18
18
  ::ActionView::Template.register_template_handler :jbuilder, ::Jbuilder::Schema::Template::Handler
19
19
  end
20
20
 
21
+ def self.build(view_context, local_assigns)
22
+ if (options = local_assigns[:__jbuilder_schema_options])
23
+ new(view_context, **options)
24
+ else
25
+ ::JbuilderTemplate.new(view_context)
26
+ end
27
+ end
28
+
21
29
  ModelScope = ::Struct.new(:model, :title, :description, keyword_init: true) do
22
30
  def initialize(**)
23
31
  super
@@ -49,6 +57,10 @@ class Jbuilder::Schema
49
57
  @ignore_nil = false
50
58
  end
51
59
 
60
+ def target!
61
+ schema!
62
+ end
63
+
52
64
  def schema!
53
65
  {type: type}.merge(type == :object ? _object(**attributes.merge) : attributes)
54
66
  end
@@ -1,4 +1,4 @@
1
1
  # We can't use the standard `Jbuilder::Schema::VERSION =` because
2
2
  # `Jbuilder` isn't a regular module namespace, but a class …which also loads Active Support.
3
3
  # So we use trickery, and assign the proper version once `jbuilder/schema.rb` is loaded.
4
- JBUILDER_SCHEMA_VERSION = "2.0.3"
4
+ JBUILDER_SCHEMA_VERSION = "2.0.4"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbuilder-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuri Sidorov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-08 00:00:00.000000000 Z
11
+ date: 2022-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jbuilder
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubygems_version: 3.3.7
79
+ rubygems_version: 3.3.16
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Generate JSON Schema from Jbuilder files