actionview 7.1.3.3 → 7.2.0.beta1

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -417
  3. data/lib/action_view/base.rb +20 -3
  4. data/lib/action_view/cache_expiry.rb +9 -3
  5. data/lib/action_view/dependency_tracker/{ripper_tracker.rb → ruby_tracker.rb} +4 -3
  6. data/lib/action_view/dependency_tracker.rb +1 -1
  7. data/lib/action_view/gem_version.rb +3 -3
  8. data/lib/action_view/helpers/asset_tag_helper.rb +15 -3
  9. data/lib/action_view/helpers/cache_helper.rb +4 -4
  10. data/lib/action_view/helpers/csrf_helper.rb +1 -1
  11. data/lib/action_view/helpers/form_helper.rb +197 -192
  12. data/lib/action_view/helpers/form_tag_helper.rb +76 -43
  13. data/lib/action_view/helpers/output_safety_helper.rb +4 -4
  14. data/lib/action_view/helpers/tag_helper.rb +208 -18
  15. data/lib/action_view/helpers/url_helper.rb +4 -78
  16. data/lib/action_view/layouts.rb +2 -4
  17. data/lib/action_view/log_subscriber.rb +8 -4
  18. data/lib/action_view/railtie.rb +0 -1
  19. data/lib/action_view/render_parser/prism_render_parser.rb +127 -0
  20. data/lib/action_view/{ripper_ast_parser.rb → render_parser/ripper_render_parser.rb} +152 -9
  21. data/lib/action_view/render_parser.rb +21 -169
  22. data/lib/action_view/renderer/abstract_renderer.rb +1 -1
  23. data/lib/action_view/renderer/renderer.rb +32 -38
  24. data/lib/action_view/rendering.rb +4 -4
  25. data/lib/action_view/template/renderable.rb +7 -1
  26. data/lib/action_view/template/resolver.rb +0 -2
  27. data/lib/action_view/template.rb +28 -4
  28. data/lib/action_view/test_case.rb +12 -14
  29. data/lib/action_view/unbound_template.rb +4 -4
  30. data/lib/action_view.rb +1 -1
  31. metadata +15 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aee97d3698a88d40710cc5c3f6bff9a2379221ae8f052a6d74b33e2bd1ee13d0
4
- data.tar.gz: 8c5969aa1c0cdc87c2a1cb48dac755bac5183af11a9403ff13c90026cfede1d9
3
+ metadata.gz: e667c2e3d2154547c2f51d406d07515af42cc9074e21e8179fdab642126821e4
4
+ data.tar.gz: 26339190cf4ab15b06913451c1ea6a750d5399ba4f7963cdc55b7f59db818ada
5
5
  SHA512:
6
- metadata.gz: 8ebd45b225b8db594d05964e88a0f34c11582675a5ccdc65f1a11590606948a01d71f548bde582ce346e5776c9f014f300ed8305511a83e2897e8771dee7e752
7
- data.tar.gz: 80fc3220fd414237ecd58e7cd2acad72a67497156af17278f452abea4cef2da1886f22368c376f9ee0f7fccc4329486e32c0deac73149546f98f7c6d510c10e9
6
+ metadata.gz: b7e494e368f95c7b398f30d88d15bcc9a6aa3cc033cd339c432447959ebf7cff2090c11bece1360303414228100a1a72a29c95aa7044ccd6861547693785f711
7
+ data.tar.gz: 732c61233f0a1c25291232981ef399afca94c0ebff7a8215b1f810696e24e8a72fa49afc2c65ce1bac92967bff1fe2aa4802c8c2bbd9cfaefd0cc8fbc8798210
data/CHANGELOG.md CHANGED
@@ -1,48 +1,54 @@
1
- ## Rails 7.1.3.3 (May 16, 2024) ##
1
+ ## Rails 7.2.0.beta1 (May 29, 2024) ##
2
2
 
3
- * No changes.
3
+ * Add queries count to template rendering instrumentation.
4
4
 
5
+ ```
6
+ # Before
7
+ Completed 200 OK in 3804ms (Views: 41.0ms | ActiveRecord: 33.5ms | Allocations: 112788)
5
8
 
6
- ## Rails 7.1.3.2 (February 21, 2024) ##
7
-
8
- * No changes.
9
-
9
+ # After
10
+ Completed 200 OK in 3804ms (Views: 41.0ms | ActiveRecord: 33.5ms (2 queries, 1 cached) | Allocations: 112788)
11
+ ```
10
12
 
11
- ## Rails 7.1.3.1 (February 21, 2024) ##
13
+ *fatkodima*
12
14
 
13
- * No changes.
15
+ * Raise `ArgumentError` if `:renderable` object does not respond to `#render_in`.
14
16
 
17
+ *Sean Doyle*
15
18
 
16
- ## Rails 7.1.3 (January 16, 2024) ##
19
+ * Add the `nonce: true` option for `stylesheet_link_tag` helper to support automatic nonce generation for Content Security Policy.
17
20
 
18
- * Better handle SyntaxError in Action View.
21
+ Works the same way as `javascript_include_tag nonce: true` does.
19
22
 
20
- *Mario Caropreso*
23
+ *Akhil G Krishnan*, *AJ Esler*
21
24
 
22
- * Fix `word_wrap` with empty string.
25
+ * Parse `ActionView::TestCase#rendered` HTML content as `Nokogiri::XML::DocumentFragment` instead of `Nokogiri::XML::Document`.
23
26
 
24
- *Jonathan Hefner*
27
+ *Sean Doyle*
25
28
 
26
29
  * Rename `ActionView::TestCase::Behavior::Content` to `ActionView::TestCase::Behavior::RenderedViewContent`.
27
30
 
28
- Make `RenderedViewContent` inherit from `String`. Make private API with `:nodoc:`.
31
+ Make `RenderedViewContent` inherit from `String`. Make private API with `:nodoc:`
29
32
 
30
33
  *Sean Doyle*
31
34
 
32
- * Fix detection of required strict locals.
35
+ * Deprecate passing `nil` as value for the `model:` argument to the `form_with` method.
33
36
 
34
- Further fix `render @collection` compatibility with strict locals
37
+ *Collin Jilbert*
35
38
 
36
- *Jean Boussier*
39
+ * Alias `field_set_tag` helper to `fieldset_tag` to match `<fieldset>` element.
40
+
41
+ *Sean Doyle*
37
42
 
43
+ * Deprecate passing content to void elements when using `tag.br` type tag builders.
38
44
 
39
- ## Rails 7.1.2 (November 10, 2023) ##
45
+ *Hartley McGuire*
40
46
 
41
47
  * Fix the `number_to_human_size` view helper to correctly work with negative numbers.
42
48
 
43
49
  *Earlopain*
44
50
 
45
- * Automatically discard the implicit locals injected by collection rendering for template that can't accept them
51
+ * Automatically discard the implicit locals injected by collection rendering for template that can't accept them.
46
52
 
47
53
  When rendering a collection, two implicit variables are injected, which breaks templates with strict locals.
48
54
 
@@ -50,20 +56,17 @@
50
56
 
51
57
  *Yasha Krasnou*, *Jean Boussier*
52
58
 
53
- * Fix `@rails/ujs` calling `start()` an extra time when using bundlers
59
+ * Fix `@rails/ujs` calling `start()` an extra time when using bundlers.
54
60
 
55
61
  *Hartley McGuire*, *Ryunosuke Sato*
56
62
 
57
- * Fix the `capture` view helper compatibility with HAML and Slim
63
+ * Fix the `capture` view helper compatibility with HAML and Slim.
58
64
 
59
65
  When a blank string was captured in HAML or Slim (and possibly other template engines)
60
66
  it would instead return the entire buffer.
61
67
 
62
68
  *Jean Boussier*
63
69
 
64
-
65
- ## Rails 7.1.1 (October 11, 2023) ##
66
-
67
70
  * Updated `@rails/ujs` files to ignore certain data-* attributes when element is contenteditable.
68
71
 
69
72
  This fix was already landed in >= 7.0.4.3, < 7.1.0.
@@ -71,406 +74,28 @@
71
74
 
72
75
  *Ryunosuke Sato*
73
76
 
77
+ * Added validation for HTML tag names in the `tag` and `content_tag` helper method.
74
78
 
75
- ## Rails 7.1.0 (October 05, 2023) ##
76
-
77
- * No changes.
78
-
79
-
80
- ## Rails 7.1.0.rc2 (October 01, 2023) ##
81
-
82
- * No changes.
83
-
84
-
85
- ## Rails 7.1.0.rc1 (September 27, 2023) ##
86
-
87
- * Introduce `ActionView::TestCase.register_parser`
88
-
89
- ```ruby
90
- register_parser :rss, -> rendered { RSS::Parser.parse(rendered) }
91
-
92
- test "renders RSS" do
93
- article = Article.create!(title: "Hello, world")
94
-
95
- render formats: :rss, partial: article
96
-
97
- assert_equal "Hello, world", rendered.rss.items.last.title
98
- end
99
- ```
100
-
101
- By default, register parsers for `:html` and `:json`.
102
-
103
- *Sean Doyle*
104
-
105
-
106
- ## Rails 7.1.0.beta1 (September 13, 2023) ##
107
-
108
- * Fix `simple_format` with blank `wrapper_tag` option returns plain html tag
109
-
110
- By default `simple_format` method returns the text wrapped with `<p>`. But if we explicitly specify
111
- the `wrapper_tag: nil` in the options, it returns the text wrapped with `<></>` tag.
112
-
113
- Before:
114
-
115
- ```ruby
116
- simple_format("Hello World", {}, { wrapper_tag: nil })
117
- # <>Hello World</>
118
- ```
119
-
120
- After:
121
-
122
- ```ruby
123
- simple_format("Hello World", {}, { wrapper_tag: nil })
124
- # <p>Hello World</p>
125
- ```
126
-
127
- *Akhil G Krishnan*, *Junichi Ito*
128
-
129
- * Don't double-encode nested `field_id` and `field_name` index values
130
-
131
- Pass `index: @options` as a default keyword argument to `field_id` and
132
- `field_name` view helper methods.
133
-
134
- *Sean Doyle*
135
-
136
- * Allow opting in/out of `Link preload` headers when calling `stylesheet_link_tag` or `javascript_include_tag`
137
-
138
- ```ruby
139
- # will exclude header, even if setting is enabled:
140
- javascript_include_tag("http://example.com/all.js", preload_links_header: false)
141
-
142
- # will include header, even if setting is disabled:
143
- stylesheet_link_tag("http://example.com/all.js", preload_links_header: true)
144
- ```
145
-
146
- *Alex Ghiculescu*
147
-
148
- * Stop generating `Link preload` headers once it has reached 1KB.
79
+ The `tag` and `content_tag` method now checks that the provided tag name adheres to the HTML
80
+ specification. If an invalid HTML tag name is provided, the method raises an `ArgumentError`
81
+ with an appropriate error message.
149
82
 
150
- Some proxies have trouble handling large headers, but more importantly preload links
151
- have diminishing returns so it's preferable not to go overboard with them.
83
+ Examples:
152
84
 
153
- If tighter control is needed, it's recommended to disable automatic generation of preloads
154
- and to generate them manually from the controller or from a middleware.
155
-
156
- *Jean Boussier*
157
-
158
- * `simple_format` helper now handles a `:sanitize_options` - any extra options you want appending to the sanitize.
159
-
160
- Before:
161
85
  ```ruby
162
- simple_format("<a target=\"_blank\" href=\"http://example.com\">Continue</a>")
163
- # => "<p><a href=\"http://example.com\">Continue</a></p>"
164
- ```
86
+ # Raises ArgumentError: Invalid HTML5 tag name: 12p
87
+ content_tag("12p") # Starting with a number
165
88
 
166
- After:
167
- ```ruby
168
- simple_format("<a target=\"_blank\" href=\"http://example.com\">Continue</a>", {}, { sanitize_options: { attributes: %w[target href] } })
169
- # => "<p><a target=\"_blank\" href=\"http://example.com\">Continue</a></p>"
170
- ```
171
-
172
- *Andrei Andriichuk*
173
-
174
- * Add support for HTML5 standards-compliant sanitizers, and default to `Rails::HTML5::Sanitizer`
175
- in the Rails 7.1 configuration if it is supported.
176
-
177
- Action View's HTML sanitizers can be configured by setting
178
- `config.action_view.sanitizer_vendor`. Supported values are `Rails::HTML4::Sanitizer` or
179
- `Rails::HTML5::Sanitizer`.
180
-
181
- The Rails 7.1 configuration will set this to `Rails::HTML5::Sanitizer` when it is supported, and
182
- fall back to `Rails::HTML4::Sanitizer`. Previous configurations default to
183
- `Rails::HTML4::Sanitizer`.
184
-
185
- *Mike Dalessio*
89
+ # Raises ArgumentError: Invalid HTML5 tag name: ""
90
+ content_tag("") # Empty tag name
186
91
 
187
- * `config.dom_testing_default_html_version` controls the HTML parser used by
188
- `ActionView::TestCase#document_root_element`, which creates the DOM used by the assertions in
189
- Rails::Dom::Testing.
92
+ # Raises ArgumentError: Invalid HTML5 tag name: div/
93
+ tag("div/") # Contains a solidus
190
94
 
191
- The Rails 7.1 default configuration opts into the HTML5 parser when it is supported, to better
192
- represent what the DOM would be in a browser user agent. Previously this test helper always used
193
- Nokogiri's HTML4 parser.
194
-
195
- *Mike Dalessio*
196
-
197
- * Add support for the HTML picture tag. It supports passing a String, an Array or a Block.
198
- Supports passing properties directly to the img tag via the `:image` key.
199
- Since the picture tag requires an img tag, the last element you provide will be used for the img tag.
200
- For complete control over the picture tag, a block can be passed, which will populate the contents of the tag accordingly.
201
-
202
- Can be used like this for a single source:
203
- ```erb
204
- <%= picture_tag("picture.webp") %>
95
+ # Raises ArgumentError: Invalid HTML5 tag name: "image file"
96
+ tag("image file") # Contains a space
205
97
  ```
206
- which will generate the following:
207
- ```html
208
- <picture>
209
- <img src="/images/picture.webp" />
210
- </picture>
211
- ```
212
-
213
- For multiple sources:
214
- ```erb
215
- <%= picture_tag("picture.webp", "picture.png", :class => "mt-2", :image => { alt: "Image", class: "responsive-img" }) %>
216
- ```
217
- will generate:
218
- ```html
219
- <picture class="mt-2">
220
- <source srcset="/images/picture.webp" />
221
- <source srcset="/images/picture.png" />
222
- <img alt="Image" class="responsive-img" src="/images/picture.png" />
223
- </picture>
224
- ```
225
-
226
- Full control via a block:
227
- ```erb
228
- <%= picture_tag(:class => "my-class") do %>
229
- <%= tag(:source, :srcset => image_path("picture.webp")) %>
230
- <%= tag(:source, :srcset => image_path("picture.png")) %>
231
- <%= image_tag("picture.png", :alt => "Image") %>
232
- <% end %>
233
- ```
234
- will generate:
235
- ```html
236
- <picture class="my-class">
237
- <source srcset="/images/picture.webp" />
238
- <source srcset="/images/picture.png" />
239
- <img alt="Image" src="/images/picture.png" />
240
- </picture>
241
- ```
242
-
243
- *Juan Pablo Balarini*
244
-
245
- * Remove deprecated support to passing instance variables as locals to partials.
246
-
247
- *Rafael Mendonça França*
248
-
249
- * Remove deprecated constant `ActionView::Path`.
250
-
251
- *Rafael Mendonça França*
252
-
253
- * Guard `token_list` calls from escaping HTML too often
254
-
255
- *Sean Doyle*
256
-
257
- * `select` can now be called with a single hash containing options and some HTML options
258
-
259
- Previously this would not work as expected:
260
-
261
- ```erb
262
- <%= select :post, :author, authors, required: true %>
263
- ```
264
-
265
- Instead you needed to do this:
266
-
267
- ```erb
268
- <%= select :post, :author, authors, {}, required: true %>
269
- ```
270
-
271
- Now, either form is accepted, for the following HTML attributes: `required`, `multiple`, `size`.
272
-
273
- *Alex Ghiculescu*
274
98
 
275
- * Datetime form helpers (`time_field`, `date_field`, `datetime_field`, `week_field`, `month_field`) now accept an instance of Time/Date/DateTime as `:value` option.
276
-
277
- Before:
278
- ```erb
279
- <%= form.datetime_field :written_at, value: Time.current.strftime("%Y-%m-%dT%T") %>
280
- ```
281
-
282
- After:
283
- ```erb
284
- <%= form.datetime_field :written_at, value: Time.current %>
285
- ```
286
-
287
- *Andrey Samsonov*
288
-
289
- * Choices of `select` can optionally contain html attributes as the last element
290
- of the child arrays when using grouped/nested collections
291
-
292
- ```erb
293
- <%= form.select :foo, [["North America", [["United States","US"],["Canada","CA"]], { disabled: "disabled" }]] %>
294
- # => <select><optgroup label="North America" disabled="disabled"><option value="US">United States</option><option value="CA">Canada</option></optgroup></select>
295
- ```
296
-
297
- *Chris Gunther*
298
-
299
- * `check_box_tag` and `radio_button_tag` now accept `checked` as a keyword argument
300
-
301
- This is to make the API more consistent with the `FormHelper` variants. You can now
302
- provide `checked` as a positional or keyword argument:
303
-
304
- ```erb
305
- = check_box_tag "admin", "1", false
306
- = check_box_tag "admin", "1", checked: false
307
-
308
- = radio_button_tag 'favorite_color', 'maroon', false
309
- = radio_button_tag 'favorite_color', 'maroon', checked: false
310
- ```
311
-
312
- *Alex Ghiculescu*
313
-
314
- * Allow passing a class to `dom_id`.
315
- You no longer need to call `new` when passing a class to `dom_id`.
316
- This makes `dom_id` behave like `dom_class` in this regard.
317
- Apart from saving a few keystrokes, it prevents Ruby from needing
318
- to instantiate a whole new object just to generate a string.
319
-
320
- Before:
321
- ```ruby
322
- dom_id(Post) # => NoMethodError: undefined method `to_key' for Post:Class
323
- ```
324
-
325
- After:
326
- ```ruby
327
- dom_id(Post) # => "new_post"
328
- ```
329
-
330
- *Goulven Champenois*
331
-
332
- * Report `:locals` as part of the data returned by ActionView render instrumentation.
333
-
334
- Before:
335
- ```ruby
336
- {
337
- identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb",
338
- layout: "layouts/application"
339
- }
340
- ```
341
-
342
- After:
343
- ```ruby
344
- {
345
- identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb",
346
- layout: "layouts/application",
347
- locals: {foo: "bar"}
348
- }
349
- ```
350
-
351
- *Aaron Gough*
352
-
353
- * Strip `break_sequence` at the end of `word_wrap`.
354
-
355
- This fixes a bug where `word_wrap` didn't properly strip off break sequences that had printable characters.
356
-
357
- For example, compare the outputs of this template:
358
-
359
- ```erb
360
- # <%= word_wrap("11 22\n33 44", line_width: 2, break_sequence: "\n# ") %>
361
- ```
362
-
363
- Before:
364
-
365
- ```
366
- # 11
367
- # 22
368
- #
369
- # 33
370
- # 44
371
- #
372
- ```
373
-
374
- After:
375
-
376
- ```
377
- # 11
378
- # 22
379
- # 33
380
- # 44
381
- ```
382
-
383
- *Max Chernyak*
384
-
385
- * Allow templates to set strict `locals`.
386
-
387
- By default, templates will accept any `locals` as keyword arguments. To define what `locals` a template accepts, add a `locals` magic comment:
388
-
389
- ```erb
390
- <%# locals: (message:) -%>
391
- <%= message %>
392
- ```
393
-
394
- Default values can also be provided:
395
-
396
- ```erb
397
- <%# locals: (message: "Hello, world!") -%>
398
- <%= message %>
399
- ```
400
-
401
- Or `locals` can be disabled entirely:
402
-
403
- ```erb
404
- <%# locals: () %>
405
- ```
406
-
407
- *Joel Hawksley*
408
-
409
- * Add `include_seconds` option for `datetime_local_field`
410
-
411
- This allows to omit seconds part in the input field, by passing `include_seconds: false`
412
-
413
- *Wojciech Wnętrzak*
414
-
415
- * Guard against `ActionView::Helpers::FormTagHelper#field_name` calls with nil
416
- `object_name` arguments. For example:
417
-
418
- ```erb
419
- <%= fields do |f| %>
420
- <%= f.field_name :body %>
421
- <% end %>
422
- ```
423
-
424
- *Sean Doyle*
425
-
426
- * Strings returned from `strip_tags` are correctly tagged `html_safe?`
427
-
428
- Because these strings contain no HTML elements and the basic entities are escaped, they are safe
429
- to be included as-is as PCDATA in HTML content. Tagging them as html-safe avoids double-escaping
430
- entities when being concatenated to a SafeBuffer during rendering.
431
-
432
- Fixes [rails/rails-html-sanitizer#124](https://github.com/rails/rails-html-sanitizer/issues/124)
433
-
434
- *Mike Dalessio*
435
-
436
- * Move `convert_to_model` call from `form_for` into `form_with`
437
-
438
- Now that `form_for` is implemented in terms of `form_with`, remove the
439
- `convert_to_model` call from `form_for`.
440
-
441
- *Sean Doyle*
442
-
443
- * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
444
-
445
- Escape dangerous characters in names of tags and names of attributes in the
446
- tag helpers, following the XML specification. Rename the option
447
- `:escape_attributes` to `:escape`, to simplify by applying the option to the
448
- whole tag.
449
-
450
- *Álvaro Martín Fraguas*
451
-
452
- * Extend audio_tag and video_tag to accept Active Storage attachments.
453
-
454
- Now it's possible to write
455
-
456
- ```ruby
457
- audio_tag(user.audio_file)
458
- video_tag(user.video_file)
459
- ```
460
-
461
- Instead of
462
-
463
- ```ruby
464
- audio_tag(polymorphic_path(user.audio_file))
465
- video_tag(polymorphic_path(user.video_file))
466
- ```
467
-
468
- `image_tag` already supported that, so this follows the same pattern.
469
-
470
- *Matheus Richard*
471
-
472
- * Ensure models passed to `form_for` attempt to call `to_model`.
473
-
474
- *Sean Doyle*
99
+ *Akhil G Krishnan*
475
100
 
476
- Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionview/CHANGELOG.md) for previous changes.
101
+ Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionview/CHANGELOG.md) for previous changes.
@@ -80,6 +80,23 @@ module ActionView # :nodoc:
80
80
  # This is useful in cases where you aren't sure if the local variable has been assigned. Alternatively, you could also use
81
81
  # <tt>defined? headline</tt> to first check if the variable has been assigned before using it.
82
82
  #
83
+ # By default, templates will accept any <tt>locals</tt> as keyword arguments. To restrict what <tt>locals</tt> a template accepts, add a <tt>locals:</tt> magic comment:
84
+ #
85
+ # <%# locals: (headline:) %>
86
+ #
87
+ # Headline: <%= headline %>
88
+ #
89
+ # In cases where the local variables are optional, declare the keyword argument with a default value:
90
+ #
91
+ # <%# locals: (headline: nil) %>
92
+ #
93
+ # <% unless headline.nil? %>
94
+ # Headline: <%= headline %>
95
+ # <% end %>
96
+ #
97
+ # Read more about strict locals in {Action View Overview}[https://guides.rubyonrails.org/action_view_overview.html#strict-locals]
98
+ # in the guides.
99
+ #
83
100
  # === Template caching
84
101
  #
85
102
  # By default, \Rails will compile each template to a method in order to render it. When you alter a template,
@@ -136,8 +153,7 @@ module ActionView # :nodoc:
136
153
  # end
137
154
  # end
138
155
  #
139
- # For more information on Builder please consult the {source
140
- # code}[https://github.com/jimweirich/builder].
156
+ # For more information on Builder please consult the {source code}[https://github.com/rails/builder].
141
157
  class Base
142
158
  include Helpers, ::ERB::Util, Context
143
159
 
@@ -257,7 +273,8 @@ module ActionView # :nodoc:
257
273
  message.
258
274
  gsub("unknown keyword:", "unknown local:").
259
275
  gsub("missing keyword:", "missing local:").
260
- gsub("no keywords accepted", "no locals accepted")
276
+ gsub("no keywords accepted", "no locals accepted").
277
+ concat(" for #{@current_template.short_identifier}")
261
278
  )
262
279
  end
263
280
  else
@@ -10,16 +10,17 @@ module ActionView
10
10
  @watcher = nil
11
11
  @previous_change = false
12
12
 
13
- rebuild_watcher
14
-
15
13
  ActionView::PathRegistry.file_system_resolver_hooks << method(:rebuild_watcher)
16
14
  end
17
15
 
18
16
  def updated?
17
+ build_watcher unless @watcher
19
18
  @previous_change || @watcher.updated?
20
19
  end
21
20
 
22
21
  def execute
22
+ return unless @watcher
23
+
23
24
  watcher = nil
24
25
  @mutex.synchronize do
25
26
  @previous_change = false
@@ -33,7 +34,7 @@ module ActionView
33
34
  ActionView::LookupContext::DetailsKey.clear
34
35
  end
35
36
 
36
- def rebuild_watcher
37
+ def build_watcher
37
38
  @mutex.synchronize do
38
39
  old_watcher = @watcher
39
40
 
@@ -51,6 +52,11 @@ module ActionView
51
52
  end
52
53
  end
53
54
 
55
+ def rebuild_watcher
56
+ return unless @watcher
57
+ build_watcher
58
+ end
59
+
54
60
  def dirs_to_watch
55
61
  all_view_paths.uniq.sort
56
62
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ActionView
4
4
  class DependencyTracker # :nodoc:
5
- class RipperTracker # :nodoc:
5
+ class RubyTracker # :nodoc:
6
6
  EXPLICIT_DEPENDENCY = /# Template Dependency: (\S+)/
7
7
 
8
8
  def self.call(name, template, view_paths = nil)
@@ -17,8 +17,9 @@ module ActionView
17
17
  true
18
18
  end
19
19
 
20
- def initialize(name, template, view_paths = nil)
20
+ def initialize(name, template, view_paths = nil, parser_class: RenderParser::Default)
21
21
  @name, @template, @view_paths = name, template, view_paths
22
+ @parser_class = parser_class
22
23
  end
23
24
 
24
25
  private
@@ -29,7 +30,7 @@ module ActionView
29
30
 
30
31
  compiled_source = template.handler.call(template, template.source)
31
32
 
32
- RenderParser.new(@name, compiled_source).render_calls.filter_map do |render_call|
33
+ @parser_class.new(@name, compiled_source).render_calls.filter_map do |render_call|
33
34
  next if render_call.end_with?("/_")
34
35
  render_call.gsub(%r|/_|, "/")
35
36
  end
@@ -9,7 +9,7 @@ module ActionView
9
9
  extend ActiveSupport::Autoload
10
10
 
11
11
  autoload :ERBTracker
12
- autoload :RipperTracker
12
+ autoload :RubyTracker
13
13
 
14
14
  @trackers = Concurrent::Map.new
15
15
 
@@ -8,9 +8,9 @@ module ActionView
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 7
11
- MINOR = 1
12
- TINY = 3
13
- PRE = "3"
11
+ MINOR = 2
12
+ TINY = 0
13
+ PRE = "beta1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end