actionview 6.0.2.2 → 6.0.3.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionview might be problematic. Click here for more details.

Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.rdoc +1 -1
  4. data/lib/action_view.rb +1 -0
  5. data/lib/action_view/cache_expiry.rb +0 -1
  6. data/lib/action_view/flows.rb +0 -1
  7. data/lib/action_view/gem_version.rb +2 -2
  8. data/lib/action_view/helpers/active_model_helper.rb +0 -1
  9. data/lib/action_view/helpers/asset_tag_helper.rb +1 -1
  10. data/lib/action_view/helpers/cache_helper.rb +1 -2
  11. data/lib/action_view/helpers/date_helper.rb +1 -2
  12. data/lib/action_view/helpers/form_helper.rb +2 -2
  13. data/lib/action_view/helpers/javascript_helper.rb +1 -1
  14. data/lib/action_view/helpers/number_helper.rb +3 -2
  15. data/lib/action_view/helpers/tag_helper.rb +2 -2
  16. data/lib/action_view/helpers/tags/base.rb +0 -1
  17. data/lib/action_view/helpers/tags/check_box.rb +0 -1
  18. data/lib/action_view/helpers/tags/collection_check_boxes.rb +0 -1
  19. data/lib/action_view/helpers/tags/collection_helpers.rb +0 -1
  20. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +0 -1
  21. data/lib/action_view/helpers/tags/color_field.rb +0 -1
  22. data/lib/action_view/helpers/tags/date_field.rb +0 -1
  23. data/lib/action_view/helpers/tags/date_select.rb +0 -1
  24. data/lib/action_view/helpers/tags/datetime_field.rb +0 -1
  25. data/lib/action_view/helpers/tags/datetime_local_field.rb +0 -1
  26. data/lib/action_view/helpers/tags/label.rb +0 -1
  27. data/lib/action_view/helpers/tags/month_field.rb +0 -1
  28. data/lib/action_view/helpers/tags/radio_button.rb +0 -1
  29. data/lib/action_view/helpers/tags/select.rb +0 -1
  30. data/lib/action_view/helpers/tags/text_field.rb +0 -1
  31. data/lib/action_view/helpers/tags/time_field.rb +0 -1
  32. data/lib/action_view/helpers/tags/week_field.rb +0 -1
  33. data/lib/action_view/helpers/text_helper.rb +0 -1
  34. data/lib/action_view/helpers/translation_helper.rb +6 -7
  35. data/lib/action_view/layouts.rb +0 -3
  36. data/lib/action_view/log_subscriber.rb +0 -1
  37. data/lib/action_view/lookup_context.rb +4 -3
  38. data/lib/action_view/path_set.rb +0 -1
  39. data/lib/action_view/record_identifier.rb +0 -1
  40. data/lib/action_view/renderer/abstract_renderer.rb +0 -1
  41. data/lib/action_view/renderer/partial_renderer.rb +0 -1
  42. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +1 -1
  43. data/lib/action_view/renderer/streaming_template_renderer.rb +0 -2
  44. data/lib/action_view/renderer/template_renderer.rb +1 -2
  45. data/lib/action_view/rendering.rb +0 -1
  46. data/lib/action_view/template.rb +0 -1
  47. data/lib/action_view/template/error.rb +9 -14
  48. data/lib/action_view/template/handlers/erb.rb +0 -1
  49. data/lib/action_view/template/resolver.rb +1 -5
  50. data/lib/action_view/test_case.rb +2 -3
  51. data/lib/action_view/testing/resolvers.rb +0 -1
  52. data/lib/action_view/unbound_template.rb +1 -2
  53. data/lib/action_view/view_paths.rb +0 -1
  54. metadata +15 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e844565ef062807f0c49c2b785fd8ce1ddedfd9cf185775ea1ea3e04ed78d7e
4
- data.tar.gz: 13e540c5b163d465961d1130ff8de4617f734e20c6b473d03a9d7f2a51ee2ebb
3
+ metadata.gz: 8eafe5ec8eee9ac7ae7c2a412a01e25ecf75d6895cb3a0719b00585e5d9415f3
4
+ data.tar.gz: c643fd1d07cea723cb3d19e999b27d5946ec4b4eb278f15e1b952b7de120453d
5
5
  SHA512:
6
- metadata.gz: 86437f9436156f4bcd073f6b0f4ead74f71e44a9b006486d32be1740264f9fcdb6f7278ddc03457ce0d10fb6120f476dab6b6c6b62aeaaed92331a5691ae4836
7
- data.tar.gz: 7a551f976b8d2d7023132184ebb78ebc021af9e26813a6347b4410191166e0e7a0e20f9123e6fdfecdbd8f078aa95ef9b7388beb55e46ea2436337267caab26b
6
+ metadata.gz: 642b3a371281cae6d3d1d88f1761cf74b9ad562d7a8bbe0764aa5b1dd2d4c367bfb229cbc6ee9ebb60d235e44670b68451a72fd8563efe9c640faced6f8d9f5d
7
+ data.tar.gz: 82f51fe028a6ab597daa5ba942efabc3d23690c5479740a72f7cc21167e11c4de5463450a9030897c0c743fc9d29feeae8b46c9b0a359d2686f59ff2c9fe7482
@@ -1,3 +1,24 @@
1
+ ## Rails 6.0.3.rc1 (April 30, 2020) ##
2
+
3
+ * annotated_source_code returns an empty array so TemplateErrors without a
4
+ template in the backtrace are surfaced properly by DebugExceptions.
5
+
6
+ *Guilherme Mansur*, *Kasper Timm Hansen*
7
+
8
+ * Add autoload for SyntaxErrorInTemplate so syntax errors are correctly raised by DebugExceptions.
9
+
10
+ *Guilherme Mansur*, *Gannon McGibbon*
11
+
12
+
13
+ ## Rails 6.0.2.2 (March 19, 2020) ##
14
+
15
+ * Fix possible XSS vector in escape_javascript helper
16
+
17
+ CVE-2020-5267
18
+
19
+ *Aaron Patterson*
20
+
21
+
1
22
  ## Rails 6.0.2.1 (December 18, 2019) ##
2
23
 
3
24
  * No changes.
@@ -37,4 +37,4 @@ Bug reports for the Ruby on Rails project can be filed here:
37
37
 
38
38
  Feature requests should be discussed on the rails-core mailing list here:
39
39
 
40
- * https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-core
40
+ * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -77,6 +77,7 @@ module ActionView
77
77
  autoload :ActionViewError
78
78
  autoload :EncodingError
79
79
  autoload :TemplateError
80
+ autoload :SyntaxErrorInTemplate
80
81
  autoload :WrongEncodingError
81
82
  end
82
83
  end
@@ -41,7 +41,6 @@ module ActionView
41
41
  end
42
42
 
43
43
  private
44
-
45
44
  def dirs_to_watch
46
45
  fs_paths = all_view_paths.grep(FileSystemResolver)
47
46
  fs_paths.map(&:path).sort.uniq
@@ -68,7 +68,6 @@ module ActionView
68
68
  end
69
69
 
70
70
  private
71
-
72
71
  def inside_fiber?
73
72
  Fiber.current.object_id != @root
74
73
  end
@@ -9,8 +9,8 @@ module ActionView
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
- TINY = 2
13
- PRE = "2"
12
+ TINY = 3
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -38,7 +38,6 @@ module ActionView
38
38
  end
39
39
 
40
40
  private
41
-
42
41
  def object_has_errors?
43
42
  object.respond_to?(:errors) && object.errors.respond_to?(:[]) && error_message.present?
44
43
  end
@@ -274,7 +274,7 @@ module ActionView
274
274
  crossorigin = "anonymous" if crossorigin == true || (crossorigin.blank? && as_type == "font")
275
275
  nopush = options.delete(:nopush) || false
276
276
 
277
- link_tag = tag.link({
277
+ link_tag = tag.link(**{
278
278
  rel: "preload",
279
279
  href: href,
280
280
  as: as_type,
@@ -166,7 +166,7 @@ module ActionView
166
166
  def cache(name = {}, options = {}, &block)
167
167
  if controller.respond_to?(:perform_caching) && controller.perform_caching
168
168
  name_options = options.slice(:skip_digest, :virtual_path)
169
- safe_concat(fragment_for(cache_fragment_name(name, name_options), options, &block))
169
+ safe_concat(fragment_for(cache_fragment_name(name, **name_options), options, &block))
170
170
  else
171
171
  yield
172
172
  end
@@ -227,7 +227,6 @@ module ActionView
227
227
  end
228
228
 
229
229
  private
230
-
231
230
  def fragment_name_with_digest(name, virtual_path, digest_path)
232
231
  virtual_path ||= @virtual_path
233
232
 
@@ -688,7 +688,6 @@ module ActionView
688
688
  end
689
689
 
690
690
  private
691
-
692
691
  def normalize_distance_of_time_argument_to_time(value)
693
692
  if value.is_a?(Numeric)
694
693
  Time.at(value)
@@ -831,7 +830,7 @@ module ActionView
831
830
  end
832
831
 
833
832
  def select_year
834
- if !@datetime || @datetime == 0
833
+ if !year || @datetime == 0
835
834
  val = "1"
836
835
  middle_year = Date.today.year
837
836
  else
@@ -755,10 +755,10 @@ module ActionView
755
755
  output = capture(builder, &block)
756
756
  options[:multipart] ||= builder.multipart?
757
757
 
758
- html_options = html_options_for_form_with(url, model, options)
758
+ html_options = html_options_for_form_with(url, model, **options)
759
759
  form_tag_with_body(html_options, output)
760
760
  else
761
- html_options = html_options_for_form_with(url, model, options)
761
+ html_options = html_options_for_form_with(url, model, **options)
762
762
  form_tag_html(html_options)
763
763
  end
764
764
  end
@@ -31,7 +31,7 @@ module ActionView
31
31
  if javascript.empty?
32
32
  result = ""
33
33
  else
34
- result = javascript.gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"']|[`]|[$])/u) { |match| JS_ESCAPE_MAP[match] }
34
+ result = javascript.gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"']|[`]|[$])/u, JS_ESCAPE_MAP)
35
35
  end
36
36
  javascript.html_safe? ? result.html_safe : result
37
37
  end
@@ -57,7 +57,7 @@ module ActionView
57
57
  #
58
58
  # number_to_phone(75561234567, pattern: /(\d{1,4})(\d{4})(\d{4})$/, area_code: true)
59
59
  # # => "(755) 6123-4567"
60
- # number_to_phone(13312345678, pattern: /(\d{3})(\d{4})(\d{4})$/))
60
+ # number_to_phone(13312345678, pattern: /(\d{3})(\d{4})(\d{4})$/)
61
61
  # # => "133-1234-5678"
62
62
  def number_to_phone(number, options = {})
63
63
  return unless number
@@ -114,6 +114,8 @@ module ActionView
114
114
  #
115
115
  # number_to_currency("123a456", raise: true) # => InvalidNumberError
116
116
  #
117
+ # number_to_currency(-0.456789, precision: 0)
118
+ # # => "$0"
117
119
  # number_to_currency(-1234567890.50, negative_format: "(%u%n)")
118
120
  # # => ($1,234,567,890.50)
119
121
  # number_to_currency(1234567890.50, unit: "R$", separator: ",", delimiter: "")
@@ -403,7 +405,6 @@ module ActionView
403
405
  end
404
406
 
405
407
  private
406
-
407
408
  def delegate_number_helper_method(method, number, options)
408
409
  return unless number
409
410
  options = escape_unsafe_options(options.symbolize_keys)
@@ -107,8 +107,8 @@ module ActionView
107
107
  true
108
108
  end
109
109
 
110
- def method_missing(called, *args, &block)
111
- tag_string(called, *args, &block)
110
+ def method_missing(called, *args, **options, &block)
111
+ tag_string(called, *args, **options, &block)
112
112
  end
113
113
  end
114
114
 
@@ -34,7 +34,6 @@ module ActionView
34
34
  end
35
35
 
36
36
  private
37
-
38
37
  def value
39
38
  if @allow_method_names_outside_object
40
39
  object.public_send @method_name if object && object.respond_to?(@method_name)
@@ -39,7 +39,6 @@ module ActionView
39
39
  end
40
40
 
41
41
  private
42
-
43
42
  def checked?(value)
44
43
  case value
45
44
  when TrueClass, FalseClass
@@ -22,7 +22,6 @@ module ActionView
22
22
  end
23
23
 
24
24
  private
25
-
26
25
  def render_component(builder)
27
26
  builder.check_box + builder.label
28
27
  end
@@ -37,7 +37,6 @@ module ActionView
37
37
  end
38
38
 
39
39
  private
40
-
41
40
  def instantiate_builder(builder_class, item, value, text, html_options)
42
41
  builder_class.new(@template_object, @object_name, @method_name, item,
43
42
  sanitize_attribute_name(value), text, value, html_options)
@@ -21,7 +21,6 @@ module ActionView
21
21
  end
22
22
 
23
23
  private
24
-
25
24
  def render_component(builder)
26
25
  builder.radio_button + builder.label
27
26
  end
@@ -12,7 +12,6 @@ module ActionView
12
12
  end
13
13
 
14
14
  private
15
-
16
15
  def validate_color_string(string)
17
16
  regex = /#[0-9a-fA-F]{6}/
18
17
  if regex.match?(string)
@@ -5,7 +5,6 @@ module ActionView
5
5
  module Tags # :nodoc:
6
6
  class DateField < DatetimeField # :nodoc:
7
7
  private
8
-
9
8
  def format_date(value)
10
9
  value.try(:strftime, "%Y-%m-%d")
11
10
  end
@@ -23,7 +23,6 @@ module ActionView
23
23
  end
24
24
 
25
25
  private
26
-
27
26
  def select_type
28
27
  self.class.select_type
29
28
  end
@@ -14,7 +14,6 @@ module ActionView
14
14
  end
15
15
 
16
16
  private
17
-
18
17
  def format_date(value)
19
18
  raise NotImplementedError
20
19
  end
@@ -11,7 +11,6 @@ module ActionView
11
11
  end
12
12
 
13
13
  private
14
-
15
14
  def format_date(value)
16
15
  value.try(:strftime, "%Y-%m-%dT%T")
17
16
  end
@@ -71,7 +71,6 @@ module ActionView
71
71
  end
72
72
 
73
73
  private
74
-
75
74
  def render_component(builder)
76
75
  builder.translation
77
76
  end
@@ -5,7 +5,6 @@ module ActionView
5
5
  module Tags # :nodoc:
6
6
  class MonthField < DatetimeField # :nodoc:
7
7
  private
8
-
9
8
  def format_date(value)
10
9
  value.try(:strftime, "%Y-%m")
11
10
  end
@@ -23,7 +23,6 @@ module ActionView
23
23
  end
24
24
 
25
25
  private
26
-
27
26
  def checked?(value)
28
27
  value.to_s == @tag_value.to_s
29
28
  end
@@ -29,7 +29,6 @@ module ActionView
29
29
  end
30
30
 
31
31
  private
32
-
33
32
  # Grouped choices look like this:
34
33
  #
35
34
  # [nil, []]
@@ -24,7 +24,6 @@ module ActionView
24
24
  end
25
25
 
26
26
  private
27
-
28
27
  def field_type
29
28
  self.class.field_type
30
29
  end
@@ -5,7 +5,6 @@ module ActionView
5
5
  module Tags # :nodoc:
6
6
  class TimeField < DatetimeField # :nodoc:
7
7
  private
8
-
9
8
  def format_date(value)
10
9
  value.try(:strftime, "%T.%L")
11
10
  end
@@ -5,7 +5,6 @@ module ActionView
5
5
  module Tags # :nodoc:
6
6
  class WeekField < DatetimeField # :nodoc:
7
7
  private
8
-
9
8
  def format_date(value)
10
9
  value.try(:strftime, "%Y-W%V")
11
10
  end
@@ -426,7 +426,6 @@ module ActionView
426
426
  end
427
427
 
428
428
  private
429
-
430
429
  def next_index
431
430
  step_index(1)
432
431
  end
@@ -57,8 +57,7 @@ module ActionView
57
57
  # that include HTML tags so that you know what kind of output to expect
58
58
  # when you call translate in a template and translators know which keys
59
59
  # they can provide HTML values for.
60
- def translate(key, options = {})
61
- options = options.dup
60
+ def translate(key, **options)
62
61
  if options.has_key?(:default)
63
62
  remaining_defaults = Array.wrap(options.delete(:default)).compact
64
63
  options[:default] = remaining_defaults unless remaining_defaults.first.kind_of?(Symbol)
@@ -82,18 +81,18 @@ module ActionView
82
81
  html_safe_options[name] = ERB::Util.html_escape(value.to_s)
83
82
  end
84
83
  end
85
- translation = I18n.translate(scope_key_by_partial(key), html_safe_options.merge(raise: i18n_raise))
84
+ translation = I18n.translate(scope_key_by_partial(key), **html_safe_options.merge(raise: i18n_raise))
86
85
  if translation.respond_to?(:map)
87
86
  translation.map { |element| element.respond_to?(:html_safe) ? element.html_safe : element }
88
87
  else
89
88
  translation.respond_to?(:html_safe) ? translation.html_safe : translation
90
89
  end
91
90
  else
92
- I18n.translate(scope_key_by_partial(key), options.merge(raise: i18n_raise))
91
+ I18n.translate(scope_key_by_partial(key), **options.merge(raise: i18n_raise))
93
92
  end
94
93
  rescue I18n::MissingTranslationData => e
95
94
  if remaining_defaults.present?
96
- translate remaining_defaults.shift, options.merge(default: remaining_defaults)
95
+ translate remaining_defaults.shift, **options.merge(default: remaining_defaults)
97
96
  else
98
97
  raise e if raise_error
99
98
 
@@ -116,8 +115,8 @@ module ActionView
116
115
  #
117
116
  # See https://www.rubydoc.info/github/svenfuchs/i18n/master/I18n/Backend/Base:localize
118
117
  # for more information.
119
- def localize(*args)
120
- I18n.localize(*args)
118
+ def localize(object, **options)
119
+ I18n.localize(object, **options)
121
120
  end
122
121
  alias :l :localize
123
122
 
@@ -224,7 +224,6 @@ module ActionView
224
224
  # that if no layout conditions are used, this method is not used
225
225
  module LayoutConditions # :nodoc:
226
226
  private
227
-
228
227
  # Determines whether the current action has a layout definition by
229
228
  # checking the action name against the :only and :except conditions
230
229
  # set by the <tt>layout</tt> method.
@@ -334,7 +333,6 @@ module ActionView
334
333
  end
335
334
 
336
335
  private
337
-
338
336
  # If no layout is supplied, look for a template named the return
339
337
  # value of this method.
340
338
  #
@@ -372,7 +370,6 @@ module ActionView
372
370
  end
373
371
 
374
372
  private
375
-
376
373
  def _conditional_layout?
377
374
  true
378
375
  end
@@ -54,7 +54,6 @@ module ActionView
54
54
  end
55
55
 
56
56
  private
57
-
58
57
  EMPTY = ""
59
58
  def from_rails_root(string) # :doc:
60
59
  string = string.sub(rails_root, EMPTY)
@@ -61,6 +61,7 @@ module ActionView
61
61
 
62
62
  @details_keys = Concurrent::Map.new
63
63
  @digest_cache = Concurrent::Map.new
64
+ @view_context_mutex = Mutex.new
64
65
 
65
66
  def self.digest_cache(details)
66
67
  @digest_cache[details_cache_key(details)] ||= Concurrent::Map.new
@@ -89,7 +90,9 @@ module ActionView
89
90
  end
90
91
 
91
92
  def self.view_context_class(klass)
92
- @view_context_class ||= klass.with_empty_template_cache
93
+ @view_context_mutex.synchronize do
94
+ @view_context_class ||= klass.with_empty_template_cache
95
+ end
93
96
  end
94
97
  end
95
98
 
@@ -112,7 +115,6 @@ module ActionView
112
115
  end
113
116
 
114
117
  private
115
-
116
118
  def _set_detail(key, value) # :doc:
117
119
  @details = @details.dup if @digest_cache || @details_key
118
120
  @digest_cache = nil
@@ -171,7 +173,6 @@ module ActionView
171
173
  end
172
174
 
173
175
  private
174
-
175
176
  # Whenever setting view paths, makes a copy so that we can manipulate them in
176
177
  # instance objects as we wish.
177
178
  def build_view_paths(paths)
@@ -69,7 +69,6 @@ module ActionView #:nodoc:
69
69
  end
70
70
 
71
71
  private
72
-
73
72
  def _find_all(path, prefixes, args)
74
73
  prefixes = [prefixes] if String === prefixes
75
74
  prefixes.each do |prefix|
@@ -95,7 +95,6 @@ module ActionView
95
95
  end
96
96
 
97
97
  private
98
-
99
98
  # Returns a string representation of the key attribute(s) that is suitable for use in an HTML DOM id.
100
99
  # This can be overwritten to customize the default generated string representation if desired.
101
100
  # If you need to read back a key from a dom_id in order to query for the underlying database record,
@@ -75,7 +75,6 @@ module ActionView
75
75
  end
76
76
 
77
77
  private
78
-
79
78
  def extract_details(options) # :doc:
80
79
  @lookup_context.registered_details.each_with_object({}) do |key, details|
81
80
  value = options[key]
@@ -319,7 +319,6 @@ module ActionView
319
319
  end
320
320
 
321
321
  private
322
-
323
322
  def render_collection(view, template)
324
323
  identifier = (template && template.identifier) || @path
325
324
  instrument(:collection, identifier: identifier, count: @collection.size) do |payload|
@@ -12,7 +12,7 @@ module ActionView
12
12
 
13
13
  private
14
14
  def cache_collection_render(instrumentation_payload, view, template)
15
- return yield unless @options[:cached]
15
+ return yield unless @options[:cached] && view.controller.respond_to?(:perform_caching) && view.controller.perform_caching
16
16
 
17
17
  # Result is a hash with the key represents the
18
18
  # key used for cache lookup and the value is the item
@@ -27,7 +27,6 @@ module ActionView
27
27
  end
28
28
 
29
29
  private
30
-
31
30
  # This is the same logging logic as in ShowExceptions middleware.
32
31
  def log_error(exception)
33
32
  logger = ActionView::Base.logger
@@ -55,7 +54,6 @@ module ActionView
55
54
  end
56
55
 
57
56
  private
58
-
59
57
  def delayed_render(buffer, template, layout, view, locals)
60
58
  # Wrap the given buffer in the StreamingBuffer and pass it to the
61
59
  # underlying template handler. Now, every time something is concatenated
@@ -14,7 +14,6 @@ module ActionView
14
14
  end
15
15
 
16
16
  private
17
-
18
17
  # Determine the template to be rendered using the given options.
19
18
  def determine_template(options)
20
19
  keys = options.has_key?(:locals) ? options[:locals].keys : []
@@ -96,7 +95,7 @@ module ActionView
96
95
  end
97
96
  rescue ActionView::MissingTemplate
98
97
  all_details = @details.merge(formats: @lookup_context.default_formats)
99
- raise unless template_exists?(layout, nil, false, [], all_details)
98
+ raise unless template_exists?(layout, nil, false, [], **all_details)
100
99
  end
101
100
  when Proc
102
101
  resolve_layout(layout.call(@lookup_context, formats), keys, formats)
@@ -104,7 +104,6 @@ module ActionView
104
104
  end
105
105
 
106
106
  private
107
-
108
107
  # Find and render a template based on the options given.
109
108
  def _render_template(options)
110
109
  variant = options.delete(:variant)
@@ -264,7 +264,6 @@ module ActionView
264
264
  end
265
265
 
266
266
  private
267
-
268
267
  # Compile a template. This method ensures a template is compiled
269
268
  # just once and removes the source after it is compiled.
270
269
  def compile!(view)
@@ -81,19 +81,19 @@ module ActionView
81
81
  end
82
82
  end
83
83
 
84
- def source_extract(indentation = 0, output = :console)
85
- return unless num = line_number
84
+ def source_extract(indentation = 0)
85
+ return [] unless num = line_number
86
86
  num = num.to_i
87
87
 
88
- source_code = @template.source.split("\n")
88
+ source_code = @template.encode!.split("\n")
89
89
 
90
90
  start_on_line = [ num - SOURCE_CODE_RADIUS - 1, 0 ].max
91
91
  end_on_line = [ num + SOURCE_CODE_RADIUS - 1, source_code.length].min
92
92
 
93
93
  indent = end_on_line.to_s.size + indentation
94
- return unless source_code = source_code[start_on_line..end_on_line]
94
+ return [] unless source_code = source_code[start_on_line..end_on_line]
95
95
 
96
- formatted_code_for(source_code, start_on_line, indent, output)
96
+ formatted_code_for(source_code, start_on_line, indent)
97
97
  end
98
98
 
99
99
  def sub_template_of(template_path)
@@ -114,7 +114,6 @@ module ActionView
114
114
  end
115
115
 
116
116
  private
117
-
118
117
  def source_location
119
118
  if line_number
120
119
  "on line ##{line_number} of "
@@ -123,15 +122,11 @@ module ActionView
123
122
  end + file_name
124
123
  end
125
124
 
126
- def formatted_code_for(source_code, line_counter, indent, output)
127
- start_value = (output == :html) ? {} : []
128
- source_code.inject(start_value) do |result, line|
125
+ def formatted_code_for(source_code, line_counter, indent)
126
+ indent_template = "%#{indent}s: %s"
127
+ source_code.map do |line|
129
128
  line_counter += 1
130
- if output == :html
131
- result.update(line_counter.to_s => "%#{indent}s %s\n" % ["", line])
132
- else
133
- result << "%#{indent}s: %s" % [line_counter, line]
134
- end
129
+ indent_template % [line_counter, line]
135
130
  end
136
131
  end
137
132
  end
@@ -63,7 +63,6 @@ module ActionView
63
63
  end
64
64
 
65
65
  private
66
-
67
66
  def valid_encoding(string, encoding)
68
67
  # If a magic encoding comment was found, tag the
69
68
  # String with this encoding. This is for a case
@@ -93,7 +93,6 @@ module ActionView
93
93
  end
94
94
 
95
95
  private
96
-
97
96
  def canonical_no_templates(templates)
98
97
  templates.empty? ? NO_TEMPLATES : templates
99
98
  end
@@ -130,7 +129,6 @@ module ActionView
130
129
  end
131
130
 
132
131
  private
133
-
134
132
  def _find_all(name, prefix, partial, details, key, locals)
135
133
  find_templates(name, prefix, partial, details, locals)
136
134
  end
@@ -183,7 +181,6 @@ module ActionView
183
181
  end
184
182
 
185
183
  private
186
-
187
184
  def _find_all(name, prefix, partial, details, key, locals)
188
185
  path = Path.build(name, prefix, partial)
189
186
  query(path, details, details[:formats], locals, cache: !!key)
@@ -323,7 +320,6 @@ module ActionView
323
320
  end
324
321
 
325
322
  private
326
-
327
323
  def find_template_paths_from_details(path, details)
328
324
  # Instead of checking for every possible path, as our other globs would
329
325
  # do, scan the directory for files with the right prefix.
@@ -358,7 +354,7 @@ module ActionView
358
354
  end
359
355
 
360
356
  def build_regex(path, details)
361
- query = escape_entry(File.join(@path, path))
357
+ query = Regexp.escape(File.join(@path, path))
362
358
  exts = EXTENSIONS.map do |ext, prefix|
363
359
  match =
364
360
  if ext == :variants && details[ext] == :any
@@ -75,8 +75,9 @@ module ActionView
75
75
  methods.flatten.each do |method|
76
76
  _helpers.module_eval <<-end_eval, __FILE__, __LINE__ + 1
77
77
  def #{method}(*args, &block) # def current_user(*args, &block)
78
- _test_case.send(%(#{method}), *args, &block) # _test_case.send(%(current_user), *args, &block)
78
+ _test_case.send(:'#{method}', *args, &block) # _test_case.send(:'current_user', *args, &block)
79
79
  end # end
80
+ ruby2_keywords(:'#{method}') if respond_to?(:ruby2_keywords, true)
80
81
  end_eval
81
82
  end
82
83
  end
@@ -93,7 +94,6 @@ module ActionView
93
94
  end
94
95
 
95
96
  private
96
-
97
97
  def include_helper_modules!
98
98
  helper(helper_class) if helper_class
99
99
  include _helpers
@@ -163,7 +163,6 @@ module ActionView
163
163
  end
164
164
 
165
165
  private
166
-
167
166
  # Need to experiment if this priority is the best one: rendered => output_buffer
168
167
  def document_root_element
169
168
  Nokogiri::HTML::Document.parse(@rendered.blank? ? @output_buffer : @rendered).root
@@ -27,7 +27,6 @@ module ActionView #:nodoc:
27
27
  end
28
28
 
29
29
  private
30
-
31
30
  def query(path, exts, _, locals, cache:)
32
31
  regex = build_regex(path, exts)
33
32
 
@@ -18,14 +18,13 @@ module ActionView
18
18
  end
19
19
 
20
20
  private
21
-
22
21
  def build_template(locals)
23
22
  options = @options.merge(locals: locals)
24
23
  Template.new(
25
24
  @source,
26
25
  @identifer,
27
26
  @handler,
28
- options
27
+ **options
29
28
  )
30
29
  end
31
30
  end
@@ -29,7 +29,6 @@ module ActionView
29
29
  end
30
30
 
31
31
  private
32
-
33
32
  # Override this method in your controller if you want to change paths prefixes for finding views.
34
33
  # Prefixes defined here will still be added to parents' <tt>._prefixes</tt>.
35
34
  def local_prefixes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.2.2
4
+ version: 6.0.3.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-19 00:00:00.000000000 Z
11
+ date: 2020-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.2.2
19
+ version: 6.0.3.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.0.2.2
26
+ version: 6.0.3.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 6.0.2.2
95
+ version: 6.0.3.rc1
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 6.0.2.2
102
+ version: 6.0.3.rc1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: activemodel
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 6.0.2.2
109
+ version: 6.0.3.rc1
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 6.0.2.2
116
+ version: 6.0.3.rc1
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -236,10 +236,10 @@ licenses:
236
236
  - MIT
237
237
  metadata:
238
238
  bug_tracker_uri: https://github.com/rails/rails/issues
239
- changelog_uri: https://github.com/rails/rails/blob/v6.0.2.2/actionview/CHANGELOG.md
240
- documentation_uri: https://api.rubyonrails.org/v6.0.2.2/
241
- mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
242
- source_code_uri: https://github.com/rails/rails/tree/v6.0.2.2/actionview
239
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.3.rc1/actionview/CHANGELOG.md
240
+ documentation_uri: https://api.rubyonrails.org/v6.0.3.rc1/
241
+ mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
242
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.3.rc1/actionview
243
243
  post_install_message:
244
244
  rdoc_options: []
245
245
  require_paths:
@@ -251,12 +251,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
251
  version: 2.5.0
252
252
  required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  requirements:
254
- - - ">="
254
+ - - ">"
255
255
  - !ruby/object:Gem::Version
256
- version: '0'
256
+ version: 1.3.1
257
257
  requirements:
258
258
  - none
259
- rubygems_version: 3.0.3
259
+ rubygems_version: 3.1.2
260
260
  signing_key:
261
261
  specification_version: 4
262
262
  summary: Rendering framework putting the V in MVC (part of Rails).