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