nice_partials 0.10.0 → 0.10.1

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: dc5dac27b668f89801b376053aa1c335623c160f7787763a7ea116d2c536a47d
4
- data.tar.gz: e51012246b8ddebf3dab57e3d4c5b20df1f3d5d0c400fc8a3244269c0ee4a761
3
+ metadata.gz: 8e57a9c56f84e3d03132b0b2d6052dc05ee87bf981958c90c65c3ef6edb93588
4
+ data.tar.gz: 2638ca63ace50ab9ad6659edf1b48f14460f8072479bd19412331e958fe0bf68
5
5
  SHA512:
6
- metadata.gz: fe1ac04c91971f99d3f25fc72409ae48747d8341f341a479e79f96115fdc495cccf858824951cc7124c4d68e2eeec8e2c65d04c1a2af9ecee7da685cd281f46a
7
- data.tar.gz: 786ae831e3d51b59fba639bf0e7185ccf853f54c1dec14e5bb97fede30d46ef912f17b81e4a0651b59a246431e9e7a1919557f9d0bbac517c1c7cb4484c25d51
6
+ metadata.gz: c25e3ce3e8ec78ffe0c1d7626aa912d1613735df7e6c0a29e9c33996973f9ef5c6bf8f5d3bfeb2fae84ecde7b8891efde9b3d90765f249e63eefdbd6a3194eb1
7
+ data.tar.gz: cd5e70bf89695f043bc17036ca3b25d018fa6af7e3ca64f95f8d7d8cc571b9fc19c919d58f901bd35cd659a50fd7e5eba57e5546dc30b1ea883c92ee0622d67e
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
1
  source "https://rubygems.org"
2
2
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
+ ruby "3.3.3"
5
+
4
6
  gemspec
5
7
 
6
8
  gem "minitest"
@@ -15,3 +17,7 @@ end
15
17
 
16
18
  gem "view_component"
17
19
  gem "capybara"
20
+
21
+ gem "debug"
22
+
23
+ gem "net-pop", github: "ruby/net-pop" # Declare gem explicitly to workaround bug in Ruby 3.3.3. Ref: https://stackoverflow.com/a/78620570
data/Gemfile.lock CHANGED
@@ -1,221 +1,273 @@
1
+ GIT
2
+ remote: https://github.com/ruby/net-pop.git
3
+ revision: e8d0afe2773b9eb6a23c39e9e437f6fc0fc7c733
4
+ specs:
5
+ net-pop (0.1.2)
6
+
1
7
  PATH
2
8
  remote: .
3
9
  specs:
4
- nice_partials (0.10.0)
10
+ nice_partials (0.10.1)
5
11
  actionview (>= 4.2.6)
6
12
 
7
13
  GEM
8
14
  remote: https://rubygems.org/
9
15
  specs:
10
- actioncable (7.0.4.2)
11
- actionpack (= 7.0.4.2)
12
- activesupport (= 7.0.4.2)
16
+ actioncable (7.1.3.4)
17
+ actionpack (= 7.1.3.4)
18
+ activesupport (= 7.1.3.4)
13
19
  nio4r (~> 2.0)
14
20
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.4.2)
16
- actionpack (= 7.0.4.2)
17
- activejob (= 7.0.4.2)
18
- activerecord (= 7.0.4.2)
19
- activestorage (= 7.0.4.2)
20
- activesupport (= 7.0.4.2)
21
+ zeitwerk (~> 2.6)
22
+ actionmailbox (7.1.3.4)
23
+ actionpack (= 7.1.3.4)
24
+ activejob (= 7.1.3.4)
25
+ activerecord (= 7.1.3.4)
26
+ activestorage (= 7.1.3.4)
27
+ activesupport (= 7.1.3.4)
21
28
  mail (>= 2.7.1)
22
29
  net-imap
23
30
  net-pop
24
31
  net-smtp
25
- actionmailer (7.0.4.2)
26
- actionpack (= 7.0.4.2)
27
- actionview (= 7.0.4.2)
28
- activejob (= 7.0.4.2)
29
- activesupport (= 7.0.4.2)
32
+ actionmailer (7.1.3.4)
33
+ actionpack (= 7.1.3.4)
34
+ actionview (= 7.1.3.4)
35
+ activejob (= 7.1.3.4)
36
+ activesupport (= 7.1.3.4)
30
37
  mail (~> 2.5, >= 2.5.4)
31
38
  net-imap
32
39
  net-pop
33
40
  net-smtp
34
- rails-dom-testing (~> 2.0)
35
- actionpack (7.0.4.2)
36
- actionview (= 7.0.4.2)
37
- activesupport (= 7.0.4.2)
38
- rack (~> 2.0, >= 2.2.0)
41
+ rails-dom-testing (~> 2.2)
42
+ actionpack (7.1.3.4)
43
+ actionview (= 7.1.3.4)
44
+ activesupport (= 7.1.3.4)
45
+ nokogiri (>= 1.8.5)
46
+ racc
47
+ rack (>= 2.2.4)
48
+ rack-session (>= 1.0.1)
39
49
  rack-test (>= 0.6.3)
40
- rails-dom-testing (~> 2.0)
41
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.4.2)
43
- actionpack (= 7.0.4.2)
44
- activerecord (= 7.0.4.2)
45
- activestorage (= 7.0.4.2)
46
- activesupport (= 7.0.4.2)
50
+ rails-dom-testing (~> 2.2)
51
+ rails-html-sanitizer (~> 1.6)
52
+ actiontext (7.1.3.4)
53
+ actionpack (= 7.1.3.4)
54
+ activerecord (= 7.1.3.4)
55
+ activestorage (= 7.1.3.4)
56
+ activesupport (= 7.1.3.4)
47
57
  globalid (>= 0.6.0)
48
58
  nokogiri (>= 1.8.5)
49
- actionview (7.0.4.2)
50
- activesupport (= 7.0.4.2)
59
+ actionview (7.1.3.4)
60
+ activesupport (= 7.1.3.4)
51
61
  builder (~> 3.1)
52
- erubi (~> 1.4)
53
- rails-dom-testing (~> 2.0)
54
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.4.2)
56
- activesupport (= 7.0.4.2)
62
+ erubi (~> 1.11)
63
+ rails-dom-testing (~> 2.2)
64
+ rails-html-sanitizer (~> 1.6)
65
+ activejob (7.1.3.4)
66
+ activesupport (= 7.1.3.4)
57
67
  globalid (>= 0.3.6)
58
- activemodel (7.0.4.2)
59
- activesupport (= 7.0.4.2)
60
- activerecord (7.0.4.2)
61
- activemodel (= 7.0.4.2)
62
- activesupport (= 7.0.4.2)
63
- activestorage (7.0.4.2)
64
- actionpack (= 7.0.4.2)
65
- activejob (= 7.0.4.2)
66
- activerecord (= 7.0.4.2)
67
- activesupport (= 7.0.4.2)
68
+ activemodel (7.1.3.4)
69
+ activesupport (= 7.1.3.4)
70
+ activerecord (7.1.3.4)
71
+ activemodel (= 7.1.3.4)
72
+ activesupport (= 7.1.3.4)
73
+ timeout (>= 0.4.0)
74
+ activestorage (7.1.3.4)
75
+ actionpack (= 7.1.3.4)
76
+ activejob (= 7.1.3.4)
77
+ activerecord (= 7.1.3.4)
78
+ activesupport (= 7.1.3.4)
68
79
  marcel (~> 1.0)
69
- mini_mime (>= 1.1.0)
70
- activesupport (7.0.4.2)
80
+ activesupport (7.1.3.4)
81
+ base64
82
+ bigdecimal
71
83
  concurrent-ruby (~> 1.0, >= 1.0.2)
84
+ connection_pool (>= 2.2.5)
85
+ drb
72
86
  i18n (>= 1.6, < 2)
73
87
  minitest (>= 5.1)
88
+ mutex_m
74
89
  tzinfo (~> 2.0)
75
- addressable (2.8.1)
76
- public_suffix (>= 2.0.2, < 6.0)
90
+ addressable (2.8.7)
91
+ public_suffix (>= 2.0.2, < 7.0)
77
92
  ast (2.4.2)
78
- builder (3.2.4)
79
- capybara (3.38.0)
93
+ base64 (0.2.0)
94
+ bigdecimal (3.1.8)
95
+ builder (3.3.0)
96
+ capybara (3.40.0)
80
97
  addressable
81
98
  matrix
82
99
  mini_mime (>= 0.1.3)
83
- nokogiri (~> 1.8)
100
+ nokogiri (~> 1.11)
84
101
  rack (>= 1.6.0)
85
102
  rack-test (>= 0.6.3)
86
103
  regexp_parser (>= 1.5, < 3.0)
87
104
  xpath (~> 3.2)
88
- concurrent-ruby (1.2.2)
105
+ concurrent-ruby (1.3.3)
106
+ connection_pool (2.4.1)
89
107
  crass (1.0.6)
90
- date (3.3.3)
91
- erubi (1.12.0)
92
- globalid (1.1.0)
93
- activesupport (>= 5.0)
94
- i18n (1.12.0)
108
+ date (3.3.4)
109
+ debug (1.9.2)
110
+ irb (~> 1.10)
111
+ reline (>= 0.3.8)
112
+ drb (2.2.1)
113
+ erubi (1.13.0)
114
+ globalid (1.2.1)
115
+ activesupport (>= 6.1)
116
+ i18n (1.14.5)
95
117
  concurrent-ruby (~> 1.0)
96
- io-console (0.6.0)
97
- irb (1.6.3)
98
- reline (>= 0.3.0)
99
- json (2.6.3)
118
+ io-console (0.7.2)
119
+ irb (1.14.0)
120
+ rdoc (>= 4.0.0)
121
+ reline (>= 0.4.2)
122
+ json (2.7.2)
100
123
  language_server-protocol (3.17.0.3)
101
- loofah (2.19.1)
124
+ lint_roller (1.1.0)
125
+ loofah (2.22.0)
102
126
  crass (~> 1.0.2)
103
- nokogiri (>= 1.5.9)
127
+ nokogiri (>= 1.12.0)
104
128
  mail (2.8.1)
105
129
  mini_mime (>= 0.1.1)
106
130
  net-imap
107
131
  net-pop
108
132
  net-smtp
109
- marcel (1.0.2)
133
+ marcel (1.0.4)
110
134
  matrix (0.4.2)
111
- method_source (1.0.0)
112
- mini_mime (1.1.2)
113
- minitest (5.18.0)
114
- net-imap (0.3.4)
135
+ method_source (1.1.0)
136
+ mini_mime (1.1.5)
137
+ minitest (5.24.1)
138
+ mutex_m (0.2.0)
139
+ net-imap (0.4.14)
115
140
  date
116
141
  net-protocol
117
- net-pop (0.1.2)
118
- net-protocol
119
- net-protocol (0.2.1)
142
+ net-protocol (0.2.2)
120
143
  timeout
121
- net-smtp (0.3.3)
144
+ net-smtp (0.5.0)
122
145
  net-protocol
123
- nio4r (2.5.8)
124
- nokogiri (1.14.2-arm64-darwin)
146
+ nio4r (2.7.3)
147
+ nokogiri (1.16.7-arm64-darwin)
125
148
  racc (~> 1.4)
126
- nokogiri (1.14.2-x86_64-linux)
149
+ nokogiri (1.16.7-x86_64-linux)
127
150
  racc (~> 1.4)
128
- parallel (1.22.1)
129
- parser (3.2.1.1)
151
+ parallel (1.25.1)
152
+ parser (3.3.4.0)
130
153
  ast (~> 2.4.1)
131
- public_suffix (5.0.1)
132
- racc (1.6.2)
133
- rack (2.2.6.3)
134
- rack-test (2.0.2)
154
+ racc
155
+ psych (5.1.2)
156
+ stringio
157
+ public_suffix (6.0.1)
158
+ racc (1.8.0)
159
+ rack (3.1.7)
160
+ rack-session (2.0.0)
161
+ rack (>= 3.0.0)
162
+ rack-test (2.1.0)
135
163
  rack (>= 1.3)
136
- rails (7.0.4.2)
137
- actioncable (= 7.0.4.2)
138
- actionmailbox (= 7.0.4.2)
139
- actionmailer (= 7.0.4.2)
140
- actionpack (= 7.0.4.2)
141
- actiontext (= 7.0.4.2)
142
- actionview (= 7.0.4.2)
143
- activejob (= 7.0.4.2)
144
- activemodel (= 7.0.4.2)
145
- activerecord (= 7.0.4.2)
146
- activestorage (= 7.0.4.2)
147
- activesupport (= 7.0.4.2)
164
+ rackup (2.1.0)
165
+ rack (>= 3)
166
+ webrick (~> 1.8)
167
+ rails (7.1.3.4)
168
+ actioncable (= 7.1.3.4)
169
+ actionmailbox (= 7.1.3.4)
170
+ actionmailer (= 7.1.3.4)
171
+ actionpack (= 7.1.3.4)
172
+ actiontext (= 7.1.3.4)
173
+ actionview (= 7.1.3.4)
174
+ activejob (= 7.1.3.4)
175
+ activemodel (= 7.1.3.4)
176
+ activerecord (= 7.1.3.4)
177
+ activestorage (= 7.1.3.4)
178
+ activesupport (= 7.1.3.4)
148
179
  bundler (>= 1.15.0)
149
- railties (= 7.0.4.2)
150
- rails-dom-testing (2.0.3)
151
- activesupport (>= 4.2.0)
180
+ railties (= 7.1.3.4)
181
+ rails-dom-testing (2.2.0)
182
+ activesupport (>= 5.0.0)
183
+ minitest
152
184
  nokogiri (>= 1.6)
153
- rails-html-sanitizer (1.5.0)
154
- loofah (~> 2.19, >= 2.19.1)
155
- railties (7.0.4.2)
156
- actionpack (= 7.0.4.2)
157
- activesupport (= 7.0.4.2)
158
- method_source
185
+ rails-html-sanitizer (1.6.0)
186
+ loofah (~> 2.21)
187
+ nokogiri (~> 1.14)
188
+ railties (7.1.3.4)
189
+ actionpack (= 7.1.3.4)
190
+ activesupport (= 7.1.3.4)
191
+ irb
192
+ rackup (>= 1.0.0)
159
193
  rake (>= 12.2)
160
- thor (~> 1.0)
161
- zeitwerk (~> 2.5)
194
+ thor (~> 1.0, >= 1.2.2)
195
+ zeitwerk (~> 2.6)
162
196
  rainbow (3.1.1)
163
- rake (13.0.6)
164
- regexp_parser (2.7.0)
165
- reline (0.3.2)
197
+ rake (13.2.1)
198
+ rdoc (6.7.0)
199
+ psych (>= 4.0.0)
200
+ regexp_parser (2.9.2)
201
+ reline (0.5.9)
166
202
  io-console (~> 0.5)
167
- rexml (3.2.5)
168
- rubocop (1.44.1)
203
+ rexml (3.3.2)
204
+ strscan
205
+ rubocop (1.64.1)
169
206
  json (~> 2.3)
207
+ language_server-protocol (>= 3.17.0)
170
208
  parallel (~> 1.10)
171
- parser (>= 3.2.0.0)
209
+ parser (>= 3.3.0.2)
172
210
  rainbow (>= 2.2.2, < 4.0)
173
211
  regexp_parser (>= 1.8, < 3.0)
174
212
  rexml (>= 3.2.5, < 4.0)
175
- rubocop-ast (>= 1.24.1, < 2.0)
213
+ rubocop-ast (>= 1.31.1, < 2.0)
176
214
  ruby-progressbar (~> 1.7)
177
215
  unicode-display_width (>= 2.4.0, < 3.0)
178
- rubocop-ast (1.27.0)
179
- parser (>= 3.2.1.0)
180
- rubocop-performance (1.15.2)
181
- rubocop (>= 1.7.0, < 2.0)
182
- rubocop-ast (>= 0.4.0)
216
+ rubocop-ast (1.31.3)
217
+ parser (>= 3.3.1.0)
218
+ rubocop-performance (1.21.1)
219
+ rubocop (>= 1.48.1, < 2.0)
220
+ rubocop-ast (>= 1.31.1, < 2.0)
183
221
  ruby-progressbar (1.13.0)
184
- standard (1.24.3)
222
+ standard (1.39.2)
185
223
  language_server-protocol (~> 3.17.0.2)
186
- rubocop (= 1.44.1)
187
- rubocop-performance (= 1.15.2)
188
- thor (1.2.1)
189
- timeout (0.3.2)
224
+ lint_roller (~> 1.0)
225
+ rubocop (~> 1.64.0)
226
+ standard-custom (~> 1.0.0)
227
+ standard-performance (~> 1.4)
228
+ standard-custom (1.0.2)
229
+ lint_roller (~> 1.0)
230
+ rubocop (~> 1.50)
231
+ standard-performance (1.4.0)
232
+ lint_roller (~> 1.1)
233
+ rubocop-performance (~> 1.21.0)
234
+ stringio (3.1.1)
235
+ strscan (3.1.0)
236
+ thor (1.3.1)
237
+ timeout (0.4.1)
190
238
  tzinfo (2.0.6)
191
239
  concurrent-ruby (~> 1.0)
192
- unicode-display_width (2.4.2)
193
- view_component (2.82.0)
240
+ unicode-display_width (2.5.0)
241
+ view_component (3.13.0)
194
242
  activesupport (>= 5.2.0, < 8.0)
195
243
  concurrent-ruby (~> 1.0)
196
244
  method_source (~> 1.0)
197
- websocket-driver (0.7.5)
245
+ webrick (1.8.1)
246
+ websocket-driver (0.7.6)
198
247
  websocket-extensions (>= 0.1.0)
199
248
  websocket-extensions (0.1.5)
200
249
  xpath (3.2.0)
201
250
  nokogiri (~> 1.8)
202
- zeitwerk (2.6.7)
251
+ zeitwerk (2.6.16)
203
252
 
204
253
  PLATFORMS
205
- arm64-darwin-20
206
- arm64-darwin-21
207
- arm64-darwin-22
254
+ arm64-darwin
208
255
  x86_64-linux
209
256
 
210
257
  DEPENDENCIES
211
258
  capybara
259
+ debug
212
260
  irb
213
261
  minitest
262
+ net-pop!
214
263
  nice_partials!
215
264
  rails
216
265
  rake
217
266
  standard
218
267
  view_component
219
268
 
269
+ RUBY VERSION
270
+ ruby 3.3.3p89
271
+
220
272
  BUNDLED WITH
221
- 2.4.8
273
+ 2.5.16
@@ -45,10 +45,7 @@ NicePartials::DEPRECATOR = ActiveSupport::Deprecation.new("1.0", "nice_partials"
45
45
  module NicePartials::RenderingWithAutoContext
46
46
  ActionView::Base.prepend self
47
47
 
48
- def __partials
49
- @__partials ||= NicePartials::Partial::Stack.new
50
- end
51
- delegate :partial, to: :__partials
48
+ attr_reader :partial
52
49
 
53
50
  def p(*args)
54
51
  if args.empty?
@@ -63,10 +60,10 @@ module NicePartials::RenderingWithAutoContext
63
60
  # on the stack, so rendering has a fresh `partial` to store content in.
64
61
  def render(options = {}, locals = {}, &block)
65
62
  partial_locals = options.is_a?(Hash) ? options[:locals] : locals
66
- __partials.prepend nice_partial_with(partial_locals)
63
+ @partial = nice_partial_with(partial_locals)
67
64
  super
68
65
  ensure
69
- __partials.shift
66
+ @partial = partial.outer_partial
70
67
  end
71
68
 
72
69
  # Since Action View passes any `yield`s in partials through `_layout_for`, we
@@ -94,10 +91,10 @@ module NicePartials::RenderingWithAutoContext
94
91
  # Note: this happens because the `@partial` instance variable is shared between all
95
92
  # `render` calls since rendering happens in one `ActionView::Base` instance.
96
93
  def capture_with_outer_partial_access(*arguments, &block)
97
- __partials.locate_previous
98
- __partials.first.capture(*arguments, &block)
94
+ inner_partial, @partial = partial, partial.outer_partial
95
+ inner_partial.capture(*arguments, &block)
99
96
  ensure
100
- __partials.reset_locator
97
+ @partial = inner_partial
101
98
  end
102
99
  end
103
100
 
@@ -4,11 +4,14 @@ module NicePartials
4
4
  autoload :Section, "nice_partials/partial/section"
5
5
  autoload :Stack, "nice_partials/partial/stack"
6
6
 
7
+ attr_reader :outer_partial
8
+
7
9
  attr_reader :local_assigns
8
10
  alias_method :locals, :local_assigns
9
11
 
10
12
  def initialize(view_context, local_assigns = nil)
11
13
  @view_context, @local_assigns = view_context, local_assigns
14
+ @outer_partial = view_context.partial # Capture the existing outer partial we're rendering within, if any.
12
15
  end
13
16
 
14
17
  def yield(*arguments, &block)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NicePartials
4
- VERSION = "0.10.0"
4
+ VERSION = "0.10.1"
5
5
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.executables = gem.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
24
24
  gem.require_paths = ["lib"]
25
25
 
26
- gem.required_ruby_version = ">= 2.0"
26
+ gem.required_ruby_version = ">= 3.0"
27
27
 
28
28
  gem.add_dependency "actionview", '>= 4.2.6'
29
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nice_partials
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-08-31 00:00:00.000000000 Z
12
+ date: 2024-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -74,7 +74,6 @@ files:
74
74
  - lib/nice_partials/partial.rb
75
75
  - lib/nice_partials/partial/content.rb
76
76
  - lib/nice_partials/partial/section.rb
77
- - lib/nice_partials/partial/stack.rb
78
77
  - lib/nice_partials/version.rb
79
78
  - nice_partials.gemspec
80
79
  homepage: https://github.com/bullet-train-co/nice_partials
@@ -89,14 +88,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
88
  requirements:
90
89
  - - ">="
91
90
  - !ruby/object:Gem::Version
92
- version: '2.0'
91
+ version: '3.0'
93
92
  required_rubygems_version: !ruby/object:Gem::Requirement
94
93
  requirements:
95
94
  - - ">="
96
95
  - !ruby/object:Gem::Version
97
96
  version: '0'
98
97
  requirements: []
99
- rubygems_version: 3.4.19
98
+ rubygems_version: 3.5.16
100
99
  signing_key:
101
100
  specification_version: 4
102
101
  summary: A little bit of magic to make partials perfect for components.
@@ -1,19 +0,0 @@
1
- class NicePartials::Partial::Stack
2
- def initialize
3
- @partials = []
4
- reset_locator
5
- end
6
- delegate :prepend, :shift, :first, to: :@partials
7
-
8
- def partial
9
- @partials.public_send @locator
10
- end
11
-
12
- def locate_previous
13
- @locator = :second
14
- end
15
-
16
- def reset_locator
17
- @locator = :first
18
- end
19
- end