actionview 5.1.7 → 5.2.4.3
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 +4 -4
- data/CHANGELOG.md +87 -224
- data/MIT-LICENSE +1 -1
- data/README.rdoc +4 -4
- data/lib/action_view.rb +4 -3
- data/lib/action_view/base.rb +8 -10
- data/lib/action_view/buffers.rb +2 -0
- data/lib/action_view/context.rb +2 -2
- data/lib/action_view/dependency_tracker.rb +2 -0
- data/lib/action_view/digestor.rb +7 -7
- data/lib/action_view/flows.rb +2 -0
- data/lib/action_view/gem_version.rb +5 -3
- data/lib/action_view/helpers.rb +4 -0
- data/lib/action_view/helpers/active_model_helper.rb +9 -3
- data/lib/action_view/helpers/asset_tag_helper.rb +180 -34
- data/lib/action_view/helpers/asset_url_helper.rb +19 -17
- data/lib/action_view/helpers/atom_feed_helper.rb +3 -1
- data/lib/action_view/helpers/cache_helper.rb +24 -14
- data/lib/action_view/helpers/capture_helper.rb +9 -7
- data/lib/action_view/helpers/controller_helper.rb +3 -1
- data/lib/action_view/helpers/csp_helper.rb +24 -0
- data/lib/action_view/helpers/csrf_helper.rb +4 -2
- data/lib/action_view/helpers/date_helper.rb +7 -5
- data/lib/action_view/helpers/debug_helper.rb +4 -2
- data/lib/action_view/helpers/form_helper.rb +53 -70
- data/lib/action_view/helpers/form_options_helper.rb +23 -17
- data/lib/action_view/helpers/form_tag_helper.rb +23 -11
- data/lib/action_view/helpers/javascript_helper.rb +20 -5
- data/lib/action_view/helpers/number_helper.rb +2 -0
- data/lib/action_view/helpers/output_safety_helper.rb +2 -0
- data/lib/action_view/helpers/record_tag_helper.rb +3 -1
- data/lib/action_view/helpers/rendering_helper.rb +3 -1
- data/lib/action_view/helpers/sanitize_helper.rb +3 -1
- data/lib/action_view/helpers/tag_helper.rb +2 -2
- data/lib/action_view/helpers/tags.rb +3 -1
- data/lib/action_view/helpers/tags/base.rb +12 -10
- data/lib/action_view/helpers/tags/check_box.rb +3 -1
- data/lib/action_view/helpers/tags/checkable.rb +4 -2
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +2 -0
- data/lib/action_view/helpers/tags/collection_helpers.rb +2 -0
- data/lib/action_view/helpers/tags/collection_radio_buttons.rb +2 -0
- data/lib/action_view/helpers/tags/collection_select.rb +3 -1
- data/lib/action_view/helpers/tags/color_field.rb +3 -1
- data/lib/action_view/helpers/tags/date_field.rb +2 -0
- data/lib/action_view/helpers/tags/date_select.rb +3 -1
- data/lib/action_view/helpers/tags/datetime_field.rb +3 -1
- data/lib/action_view/helpers/tags/datetime_local_field.rb +2 -0
- data/lib/action_view/helpers/tags/datetime_select.rb +2 -0
- data/lib/action_view/helpers/tags/email_field.rb +2 -0
- data/lib/action_view/helpers/tags/file_field.rb +2 -0
- data/lib/action_view/helpers/tags/grouped_collection_select.rb +3 -1
- data/lib/action_view/helpers/tags/hidden_field.rb +2 -0
- data/lib/action_view/helpers/tags/label.rb +2 -4
- data/lib/action_view/helpers/tags/month_field.rb +2 -0
- data/lib/action_view/helpers/tags/number_field.rb +2 -0
- data/lib/action_view/helpers/tags/password_field.rb +2 -0
- data/lib/action_view/helpers/tags/placeholderable.rb +2 -0
- data/lib/action_view/helpers/tags/radio_button.rb +3 -1
- data/lib/action_view/helpers/tags/range_field.rb +2 -0
- data/lib/action_view/helpers/tags/search_field.rb +2 -0
- data/lib/action_view/helpers/tags/select.rb +4 -2
- data/lib/action_view/helpers/tags/tel_field.rb +2 -0
- data/lib/action_view/helpers/tags/text_area.rb +3 -1
- data/lib/action_view/helpers/tags/text_field.rb +3 -1
- data/lib/action_view/helpers/tags/time_field.rb +2 -0
- data/lib/action_view/helpers/tags/time_select.rb +2 -0
- data/lib/action_view/helpers/tags/time_zone_select.rb +3 -1
- data/lib/action_view/helpers/tags/translator.rb +2 -0
- data/lib/action_view/helpers/tags/url_field.rb +2 -0
- data/lib/action_view/helpers/tags/week_field.rb +2 -0
- data/lib/action_view/helpers/text_helper.rb +9 -7
- data/lib/action_view/helpers/translation_helper.rb +5 -4
- data/lib/action_view/helpers/url_helper.rb +28 -4
- data/lib/action_view/layouts.rb +7 -5
- data/lib/action_view/log_subscriber.rb +5 -3
- data/lib/action_view/lookup_context.rb +4 -4
- data/lib/action_view/model_naming.rb +2 -0
- data/lib/action_view/path_set.rb +2 -0
- data/lib/action_view/railtie.rb +11 -2
- data/lib/action_view/record_identifier.rb +2 -0
- data/lib/action_view/renderer/abstract_renderer.rb +2 -0
- data/lib/action_view/renderer/partial_renderer.rb +13 -11
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +4 -2
- data/lib/action_view/renderer/renderer.rb +2 -0
- data/lib/action_view/renderer/streaming_template_renderer.rb +5 -1
- data/lib/action_view/renderer/template_renderer.rb +2 -0
- data/lib/action_view/rendering.rb +3 -5
- data/lib/action_view/routing_url_for.rb +2 -0
- data/lib/action_view/tasks/cache_digests.rake +2 -0
- data/lib/action_view/template.rb +6 -4
- data/lib/action_view/template/error.rb +2 -3
- data/lib/action_view/template/handlers.rb +3 -1
- data/lib/action_view/template/handlers/builder.rb +3 -4
- data/lib/action_view/template/handlers/erb.rb +5 -9
- data/lib/action_view/template/handlers/erb/erubi.rb +2 -0
- data/lib/action_view/template/handlers/html.rb +2 -0
- data/lib/action_view/template/handlers/raw.rb +2 -0
- data/lib/action_view/template/html.rb +3 -1
- data/lib/action_view/template/resolver.rb +7 -6
- data/lib/action_view/template/text.rb +3 -1
- data/lib/action_view/template/types.rb +3 -1
- data/lib/action_view/test_case.rb +21 -5
- data/lib/action_view/testing/resolvers.rb +3 -1
- data/lib/action_view/version.rb +2 -0
- data/lib/action_view/view_paths.rb +3 -3
- data/lib/assets/compiled/rails-ujs.js +52 -15
- metadata +12 -13
- data/lib/action_view/template/handlers/erb/deprecated_erubis.rb +0 -9
- data/lib/action_view/template/handlers/erb/erubis.rb +0 -81
data/lib/action_view/layouts.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "action_view/rendering"
|
|
2
|
-
require "active_support/core_ext/module/
|
|
4
|
+
require "active_support/core_ext/module/redefine_method"
|
|
3
5
|
|
|
4
6
|
module ActionView
|
|
5
7
|
# Layouts reverse the common pattern of including shared headers and footers in many templates to isolate changes in
|
|
@@ -204,9 +206,9 @@ module ActionView
|
|
|
204
206
|
include ActionView::Rendering
|
|
205
207
|
|
|
206
208
|
included do
|
|
207
|
-
class_attribute :_layout,
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
class_attribute :_layout, instance_accessor: false
|
|
210
|
+
class_attribute :_layout_conditions, instance_accessor: false, default: {}
|
|
211
|
+
|
|
210
212
|
_write_layout_method
|
|
211
213
|
end
|
|
212
214
|
|
|
@@ -277,7 +279,7 @@ module ActionView
|
|
|
277
279
|
# If a layout is not explicitly mentioned then look for a layout with the controller's name.
|
|
278
280
|
# if nothing is found then try same procedure to find super class's layout.
|
|
279
281
|
def _write_layout_method # :nodoc:
|
|
280
|
-
|
|
282
|
+
silence_redefinition_of_method(:_layout)
|
|
281
283
|
|
|
282
284
|
prefixes = /\blayouts/.match?(_implied_layout_name) ? [] : ["layouts"]
|
|
283
285
|
default_behavior = "lookup_context.find_all('#{_implied_layout_name}', #{prefixes.inspect}, false, [], { formats: formats }).first || super"
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "active_support/log_subscriber"
|
|
2
4
|
|
|
3
5
|
module ActionView
|
|
@@ -14,7 +16,7 @@ module ActionView
|
|
|
14
16
|
|
|
15
17
|
def render_template(event)
|
|
16
18
|
info do
|
|
17
|
-
message = " Rendered #{from_rails_root(event.payload[:identifier])}"
|
|
19
|
+
message = " Rendered #{from_rails_root(event.payload[:identifier])}".dup
|
|
18
20
|
message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout]
|
|
19
21
|
message << " (#{event.duration.round(1)}ms)"
|
|
20
22
|
end
|
|
@@ -22,7 +24,7 @@ module ActionView
|
|
|
22
24
|
|
|
23
25
|
def render_partial(event)
|
|
24
26
|
info do
|
|
25
|
-
message = " Rendered #{from_rails_root(event.payload[:identifier])}"
|
|
27
|
+
message = " Rendered #{from_rails_root(event.payload[:identifier])}".dup
|
|
26
28
|
message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout]
|
|
27
29
|
message << " (#{event.duration.round(1)}ms)"
|
|
28
30
|
message << " #{cache_message(event.payload)}" unless event.payload[:cache_hit].nil?
|
|
@@ -83,7 +85,7 @@ module ActionView
|
|
|
83
85
|
|
|
84
86
|
def log_rendering_start(payload)
|
|
85
87
|
info do
|
|
86
|
-
message = " Rendering #{from_rails_root(payload[:identifier])}"
|
|
88
|
+
message = " Rendering #{from_rails_root(payload[:identifier])}".dup
|
|
87
89
|
message << " within #{from_rails_root(payload[:layout])}" if payload[:layout]
|
|
88
90
|
message
|
|
89
91
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "concurrent/map"
|
|
2
4
|
require "active_support/core_ext/module/remove_method"
|
|
3
5
|
require "active_support/core_ext/module/attribute_accessors"
|
|
@@ -14,11 +16,9 @@ module ActionView
|
|
|
14
16
|
class LookupContext #:nodoc:
|
|
15
17
|
attr_accessor :prefixes, :rendered_format
|
|
16
18
|
|
|
17
|
-
mattr_accessor :fallbacks
|
|
18
|
-
@@fallbacks = FallbackFileSystemResolver.instances
|
|
19
|
+
mattr_accessor :fallbacks, default: FallbackFileSystemResolver.instances
|
|
19
20
|
|
|
20
|
-
mattr_accessor :registered_details
|
|
21
|
-
self.registered_details = []
|
|
21
|
+
mattr_accessor :registered_details, default: []
|
|
22
22
|
|
|
23
23
|
def self.register_detail(name, &block)
|
|
24
24
|
registered_details << name
|
data/lib/action_view/path_set.rb
CHANGED
data/lib/action_view/railtie.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "action_view"
|
|
2
4
|
require "rails"
|
|
3
5
|
|
|
@@ -20,8 +22,15 @@ module ActionView
|
|
|
20
22
|
initializer "action_view.form_with_generates_remote_forms" do |app|
|
|
21
23
|
ActiveSupport.on_load(:action_view) do
|
|
22
24
|
form_with_generates_remote_forms = app.config.action_view.delete(:form_with_generates_remote_forms)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
ActionView::Helpers::FormHelper.form_with_generates_remote_forms = form_with_generates_remote_forms
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
initializer "action_view.form_with_generates_ids" do |app|
|
|
30
|
+
ActiveSupport.on_load(:action_view) do
|
|
31
|
+
form_with_generates_ids = app.config.action_view.delete(:form_with_generates_ids)
|
|
32
|
+
unless form_with_generates_ids.nil?
|
|
33
|
+
ActionView::Helpers::FormHelper.form_with_generates_ids = form_with_generates_ids
|
|
25
34
|
end
|
|
26
35
|
end
|
|
27
36
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "concurrent/map"
|
|
2
4
|
require "action_view/renderer/partial_renderer/collection_caching"
|
|
3
5
|
|
|
@@ -50,12 +52,12 @@ module ActionView
|
|
|
50
52
|
# <%= render partial: "ad", locals: { ad: ad } %>
|
|
51
53
|
# <% end %>
|
|
52
54
|
#
|
|
53
|
-
# This would first render
|
|
54
|
-
# render
|
|
55
|
+
# This would first render <tt>advertiser/_account.html.erb</tt> with <tt>@buyer</tt> passed in as the local variable +account+, then
|
|
56
|
+
# render <tt>advertiser/_ad.html.erb</tt> and pass the local variable +ad+ to the template for display.
|
|
55
57
|
#
|
|
56
58
|
# == The :as and :object options
|
|
57
59
|
#
|
|
58
|
-
# By default
|
|
60
|
+
# By default ActionView::PartialRenderer doesn't have any local variables.
|
|
59
61
|
# The <tt>:object</tt> option can be used to pass an object to the partial. For instance:
|
|
60
62
|
#
|
|
61
63
|
# <%= render partial: "account", object: @buyer %>
|
|
@@ -83,7 +85,7 @@ module ActionView
|
|
|
83
85
|
#
|
|
84
86
|
# <%= render partial: "ad", collection: @advertisements %>
|
|
85
87
|
#
|
|
86
|
-
# This will render
|
|
88
|
+
# This will render <tt>advertiser/_ad.html.erb</tt> and pass the local variable +ad+ to the template for display. An
|
|
87
89
|
# iteration object will automatically be made available to the template with a name of the form
|
|
88
90
|
# +partial_name_iteration+. The iteration object has knowledge about which index the current object has in
|
|
89
91
|
# the collection and the total size of the collection. The iteration object also has two convenience methods,
|
|
@@ -98,7 +100,7 @@ module ActionView
|
|
|
98
100
|
#
|
|
99
101
|
# <%= render partial: "ad", collection: @advertisements, spacer_template: "ad_divider" %>
|
|
100
102
|
#
|
|
101
|
-
# If the given <tt>:collection</tt> is +nil+ or empty, <tt>render</tt> will return nil
|
|
103
|
+
# If the given <tt>:collection</tt> is +nil+ or empty, <tt>render</tt> will return +nil+. This will allow you
|
|
102
104
|
# to specify a text which will be displayed instead by using this form:
|
|
103
105
|
#
|
|
104
106
|
# <%= render(partial: "ad", collection: @advertisements) || "There's no ad to be displayed" %>
|
|
@@ -112,18 +114,18 @@ module ActionView
|
|
|
112
114
|
#
|
|
113
115
|
# <%= render partial: "advertisement/ad", locals: { ad: @advertisement } %>
|
|
114
116
|
#
|
|
115
|
-
# This will render the partial
|
|
117
|
+
# This will render the partial <tt>advertisement/_ad.html.erb</tt> regardless of which controller this is being called from.
|
|
116
118
|
#
|
|
117
|
-
# == \Rendering objects that respond to
|
|
119
|
+
# == \Rendering objects that respond to +to_partial_path+
|
|
118
120
|
#
|
|
119
121
|
# Instead of explicitly naming the location of a partial, you can also let PartialRenderer do the work
|
|
120
|
-
# and pick the proper path by checking
|
|
122
|
+
# and pick the proper path by checking +to_partial_path+ method.
|
|
121
123
|
#
|
|
122
124
|
# # @account.to_partial_path returns 'accounts/account', so it can be used to replace:
|
|
123
125
|
# # <%= render partial: "accounts/account", locals: { account: @account} %>
|
|
124
126
|
# <%= render partial: @account %>
|
|
125
127
|
#
|
|
126
|
-
# # @posts is an array of Post instances, so every post record returns 'posts/post' on
|
|
128
|
+
# # @posts is an array of Post instances, so every post record returns 'posts/post' on +to_partial_path+,
|
|
127
129
|
# # that's why we can replace:
|
|
128
130
|
# # <%= render partial: "posts/post", collection: @posts %>
|
|
129
131
|
# <%= render partial: @posts %>
|
|
@@ -143,7 +145,7 @@ module ActionView
|
|
|
143
145
|
# # <%= render partial: "accounts/account", locals: { account: @account} %>
|
|
144
146
|
# <%= render @account %>
|
|
145
147
|
#
|
|
146
|
-
# # @posts is an array of Post instances, so every post record returns 'posts/post' on
|
|
148
|
+
# # @posts is an array of Post instances, so every post record returns 'posts/post' on +to_partial_path+,
|
|
147
149
|
# # that's why we can replace:
|
|
148
150
|
# # <%= render partial: "posts/post", collection: @posts %>
|
|
149
151
|
# <%= render @posts %>
|
|
@@ -353,7 +355,7 @@ module ActionView
|
|
|
353
355
|
# finds the options and details and extracts them. The method also contains
|
|
354
356
|
# logic that handles the type of object passed in as the partial.
|
|
355
357
|
#
|
|
356
|
-
# If +options[:partial]+ is a string, then the
|
|
358
|
+
# If +options[:partial]+ is a string, then the <tt>@path</tt> instance variable is
|
|
357
359
|
# set to that string. Otherwise, the +options[:partial]+ object must
|
|
358
360
|
# respond to +to_partial_path+ in order to setup the path.
|
|
359
361
|
def setup(context, options, block)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActionView
|
|
2
4
|
module CollectionCaching # :nodoc:
|
|
3
5
|
extend ActiveSupport::Concern
|
|
@@ -5,7 +7,7 @@ module ActionView
|
|
|
5
7
|
included do
|
|
6
8
|
# Fallback cache store if Action View is used without Rails.
|
|
7
9
|
# Otherwise overridden in Railtie to use Rails.cache.
|
|
8
|
-
mattr_accessor
|
|
10
|
+
mattr_accessor :collection_cache, default: ActiveSupport::Cache::MemoryStore.new
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
private
|
|
@@ -38,7 +40,7 @@ module ActionView
|
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
def expanded_cache_key(key)
|
|
41
|
-
key = @view.
|
|
43
|
+
key = @view.combined_fragment_cache_key(@view.cache_fragment_name(key, virtual_path: @template.virtual_path))
|
|
42
44
|
key.frozen? ? key.dup : key # #read_multi & #write may require mutability, Dalli 2.6.0.
|
|
43
45
|
end
|
|
44
46
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "fiber"
|
|
2
4
|
|
|
3
5
|
module ActionView
|
|
@@ -31,7 +33,7 @@ module ActionView
|
|
|
31
33
|
logger = ActionView::Base.logger
|
|
32
34
|
return unless logger
|
|
33
35
|
|
|
34
|
-
message = "\n#{exception.class} (#{exception.message}):\n"
|
|
36
|
+
message = "\n#{exception.class} (#{exception.message}):\n".dup
|
|
35
37
|
message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
|
|
36
38
|
message << " " << exception.backtrace.join("\n ")
|
|
37
39
|
logger.fatal("#{message}\n\n")
|
|
@@ -63,7 +65,9 @@ module ActionView
|
|
|
63
65
|
yielder = lambda { |*name| view._layout_for(*name) }
|
|
64
66
|
|
|
65
67
|
instrument(:template, identifier: template.identifier, layout: layout.try(:virtual_path)) do
|
|
68
|
+
outer_config = I18n.config
|
|
66
69
|
fiber = Fiber.new do
|
|
70
|
+
I18n.config = outer_config
|
|
67
71
|
if layout
|
|
68
72
|
layout.render(view, locals, output, &yielder)
|
|
69
73
|
else
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "action_view/view_paths"
|
|
2
4
|
|
|
3
5
|
module ActionView
|
|
@@ -73,8 +75,7 @@ module ActionView
|
|
|
73
75
|
end
|
|
74
76
|
|
|
75
77
|
# Returns an object that is able to render templates.
|
|
76
|
-
# :
|
|
77
|
-
def view_renderer
|
|
78
|
+
def view_renderer # :nodoc:
|
|
78
79
|
@_view_renderer ||= ActionView::Renderer.new(lookup_context)
|
|
79
80
|
end
|
|
80
81
|
|
|
@@ -90,7 +91,6 @@ module ActionView
|
|
|
90
91
|
private
|
|
91
92
|
|
|
92
93
|
# Find and render a template based on the options given.
|
|
93
|
-
# :api: private
|
|
94
94
|
def _render_template(options)
|
|
95
95
|
variant = options.delete(:variant)
|
|
96
96
|
assigns = options.delete(:assigns)
|
|
@@ -112,7 +112,6 @@ module ActionView
|
|
|
112
112
|
|
|
113
113
|
# Normalize args by converting render "foo" to render :action => "foo" and
|
|
114
114
|
# render "foo/bar" to render :template => "foo/bar".
|
|
115
|
-
# :api: private
|
|
116
115
|
def _normalize_args(action = nil, options = {})
|
|
117
116
|
options = super(action, options)
|
|
118
117
|
case action
|
|
@@ -135,7 +134,6 @@ module ActionView
|
|
|
135
134
|
end
|
|
136
135
|
|
|
137
136
|
# Normalize options.
|
|
138
|
-
# :api: private
|
|
139
137
|
def _normalize_options(options)
|
|
140
138
|
options = super(options)
|
|
141
139
|
if options[:partial] == true
|
data/lib/action_view/template.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "active_support/core_ext/object/try"
|
|
2
4
|
require "active_support/core_ext/kernel/singleton_class"
|
|
3
5
|
require "thread"
|
|
@@ -282,7 +284,7 @@ module ActionView
|
|
|
282
284
|
|
|
283
285
|
# Make sure that the resulting String to be eval'd is in the
|
|
284
286
|
# encoding of the code
|
|
285
|
-
source = <<-end_src
|
|
287
|
+
source = <<-end_src.dup
|
|
286
288
|
def #{method_name}(local_assigns, output_buffer)
|
|
287
289
|
_old_virtual_path, @virtual_path = @virtual_path, #{@virtual_path.inspect};_old_output_buffer = @output_buffer;#{locals_code};#{code}
|
|
288
290
|
ensure
|
|
@@ -328,13 +330,13 @@ module ActionView
|
|
|
328
330
|
locals = @locals - Module::RUBY_RESERVED_KEYWORDS
|
|
329
331
|
locals = locals.grep(/\A@?(?![A-Z0-9])(?:[[:alnum:]_]|[^\0-\177])+\z/)
|
|
330
332
|
|
|
331
|
-
#
|
|
332
|
-
locals.each_with_object("") { |key, code| code << "#{key} = #{key} =
|
|
333
|
+
# Assign for the same variable is to suppress unused variable warning
|
|
334
|
+
locals.each_with_object("".dup) { |key, code| code << "#{key} = local_assigns[:#{key}]; #{key} = #{key};" }
|
|
333
335
|
end
|
|
334
336
|
|
|
335
337
|
def method_name
|
|
336
338
|
@method_name ||= begin
|
|
337
|
-
m = "_#{identifier_method_name}__#{@identifier.hash}_#{__id__}"
|
|
339
|
+
m = "_#{identifier_method_name}__#{@identifier.hash}_#{__id__}".dup
|
|
338
340
|
m.tr!("-".freeze, "_".freeze)
|
|
339
341
|
m
|
|
340
342
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "active_support/core_ext/enumerable"
|
|
2
4
|
|
|
3
5
|
module ActionView
|
|
@@ -8,9 +10,6 @@ module ActionView
|
|
|
8
10
|
class EncodingError < StandardError #:nodoc:
|
|
9
11
|
end
|
|
10
12
|
|
|
11
|
-
class MissingRequestError < StandardError #:nodoc:
|
|
12
|
-
end
|
|
13
|
-
|
|
14
13
|
class WrongEncodingError < EncodingError #:nodoc:
|
|
15
14
|
def initialize(string, encoding)
|
|
16
15
|
@string, @encoding = string, encoding
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActionView #:nodoc:
|
|
2
4
|
# = Action View Template Handlers
|
|
3
|
-
class Template
|
|
5
|
+
class Template #:nodoc:
|
|
4
6
|
module Handlers #:nodoc:
|
|
5
7
|
autoload :Raw, "action_view/template/handlers/raw"
|
|
6
8
|
autoload :ERB, "action_view/template/handlers/erb"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActionView
|
|
2
4
|
module Template::Handlers
|
|
3
5
|
class Builder
|
|
4
|
-
|
|
5
|
-
class_attribute :default_format
|
|
6
|
-
self.default_format = :xml
|
|
6
|
+
class_attribute :default_format, default: :xml
|
|
7
7
|
|
|
8
8
|
def call(template)
|
|
9
9
|
require_engine
|
|
@@ -14,7 +14,6 @@ module ActionView
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
private
|
|
17
|
-
|
|
18
17
|
def require_engine # :doc:
|
|
19
18
|
@required ||= begin
|
|
20
19
|
require "builder"
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActionView
|
|
2
4
|
class Template
|
|
3
5
|
module Handlers
|
|
4
|
-
autoload :Erubis, "action_view/template/handlers/erb/deprecated_erubis"
|
|
5
|
-
|
|
6
6
|
class ERB
|
|
7
7
|
autoload :Erubi, "action_view/template/handlers/erb/erubi"
|
|
8
|
-
autoload :Erubis, "action_view/template/handlers/erb/erubis"
|
|
9
8
|
|
|
10
9
|
# Specify trim mode for the ERB compiler. Defaults to '-'.
|
|
11
10
|
# See ERB documentation for suitable values.
|
|
12
|
-
class_attribute :erb_trim_mode
|
|
13
|
-
self.erb_trim_mode = "-"
|
|
11
|
+
class_attribute :erb_trim_mode, default: "-"
|
|
14
12
|
|
|
15
13
|
# Default implementation used.
|
|
16
|
-
class_attribute :erb_implementation
|
|
17
|
-
self.erb_implementation = Erubi
|
|
14
|
+
class_attribute :erb_implementation, default: Erubi
|
|
18
15
|
|
|
19
16
|
# Do not escape templates of these mime types.
|
|
20
|
-
class_attribute :escape_whitelist
|
|
21
|
-
self.escape_whitelist = ["text/plain"]
|
|
17
|
+
class_attribute :escape_whitelist, default: ["text/plain"]
|
|
22
18
|
|
|
23
19
|
ENCODING_TAG = Regexp.new("\\A(<%#{ENCODING_FLAG}-?%>)[ \\t]*")
|
|
24
20
|
|