actionview 5.0.7.2 → 5.1.7

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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +169 -345
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +1 -1
  5. data/lib/action_view/base.rb +19 -19
  6. data/lib/action_view/buffers.rb +1 -1
  7. data/lib/action_view/context.rb +1 -1
  8. data/lib/action_view/dependency_tracker.rb +4 -5
  9. data/lib/action_view/digestor.rb +22 -13
  10. data/lib/action_view/flows.rb +5 -6
  11. data/lib/action_view/gem_version.rb +2 -2
  12. data/lib/action_view/helpers/active_model_helper.rb +8 -8
  13. data/lib/action_view/helpers/asset_tag_helper.rb +62 -36
  14. data/lib/action_view/helpers/asset_url_helper.rb +111 -49
  15. data/lib/action_view/helpers/atom_feed_helper.rb +12 -13
  16. data/lib/action_view/helpers/cache_helper.rb +32 -20
  17. data/lib/action_view/helpers/capture_helper.rb +2 -2
  18. data/lib/action_view/helpers/controller_helper.rb +2 -2
  19. data/lib/action_view/helpers/csrf_helper.rb +3 -3
  20. data/lib/action_view/helpers/date_helper.rb +119 -109
  21. data/lib/action_view/helpers/debug_helper.rb +2 -3
  22. data/lib/action_view/helpers/form_helper.rb +440 -31
  23. data/lib/action_view/helpers/form_options_helper.rb +12 -12
  24. data/lib/action_view/helpers/form_tag_helper.rb +20 -19
  25. data/lib/action_view/helpers/javascript_helper.rb +6 -6
  26. data/lib/action_view/helpers/number_helper.rb +48 -46
  27. data/lib/action_view/helpers/output_safety_helper.rb +8 -8
  28. data/lib/action_view/helpers/record_tag_helper.rb +2 -2
  29. data/lib/action_view/helpers/rendering_helper.rb +2 -3
  30. data/lib/action_view/helpers/sanitize_helper.rb +16 -12
  31. data/lib/action_view/helpers/tag_helper.rb +194 -77
  32. data/lib/action_view/helpers/tags/base.rb +121 -102
  33. data/lib/action_view/helpers/tags/check_box.rb +17 -17
  34. data/lib/action_view/helpers/tags/collection_check_boxes.rb +9 -8
  35. data/lib/action_view/helpers/tags/collection_helpers.rb +60 -60
  36. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +3 -2
  37. data/lib/action_view/helpers/tags/collection_select.rb +2 -2
  38. data/lib/action_view/helpers/tags/date_select.rb +36 -36
  39. data/lib/action_view/helpers/tags/grouped_collection_select.rb +2 -2
  40. data/lib/action_view/helpers/tags/label.rb +4 -0
  41. data/lib/action_view/helpers/tags/password_field.rb +1 -1
  42. data/lib/action_view/helpers/tags/radio_button.rb +4 -4
  43. data/lib/action_view/helpers/tags/select.rb +9 -9
  44. data/lib/action_view/helpers/tags/text_area.rb +1 -1
  45. data/lib/action_view/helpers/tags/text_field.rb +5 -5
  46. data/lib/action_view/helpers/tags/translator.rb +14 -12
  47. data/lib/action_view/helpers/text_helper.rb +20 -19
  48. data/lib/action_view/helpers/translation_helper.rb +6 -6
  49. data/lib/action_view/helpers/url_helper.rb +48 -46
  50. data/lib/action_view/helpers.rb +1 -1
  51. data/lib/action_view/layouts.rb +51 -47
  52. data/lib/action_view/log_subscriber.rb +25 -9
  53. data/lib/action_view/lookup_context.rb +19 -25
  54. data/lib/action_view/path_set.rb +19 -19
  55. data/lib/action_view/railtie.rb +13 -4
  56. data/lib/action_view/record_identifier.rb +6 -6
  57. data/lib/action_view/renderer/abstract_renderer.rb +17 -17
  58. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +7 -1
  59. data/lib/action_view/renderer/partial_renderer.rb +188 -187
  60. data/lib/action_view/renderer/renderer.rb +4 -0
  61. data/lib/action_view/renderer/streaming_template_renderer.rb +45 -47
  62. data/lib/action_view/renderer/template_renderer.rb +64 -66
  63. data/lib/action_view/rendering.rb +4 -5
  64. data/lib/action_view/routing_url_for.rb +9 -13
  65. data/lib/action_view/tasks/cache_digests.rake +7 -7
  66. data/lib/action_view/template/error.rb +5 -15
  67. data/lib/action_view/template/handlers/builder.rb +7 -7
  68. data/lib/action_view/template/handlers/erb/deprecated_erubis.rb +9 -0
  69. data/lib/action_view/template/handlers/erb/erubi.rb +81 -0
  70. data/lib/action_view/template/handlers/erb/erubis.rb +81 -0
  71. data/lib/action_view/template/handlers/erb.rb +9 -76
  72. data/lib/action_view/template/handlers.rb +4 -4
  73. data/lib/action_view/template/html.rb +2 -4
  74. data/lib/action_view/template/resolver.rb +107 -90
  75. data/lib/action_view/template/text.rb +5 -8
  76. data/lib/action_view/template/types.rb +1 -1
  77. data/lib/action_view/template.rb +26 -27
  78. data/lib/action_view/test_case.rb +20 -21
  79. data/lib/action_view/testing/resolvers.rb +29 -30
  80. data/lib/action_view/version.rb +1 -1
  81. data/lib/action_view/view_paths.rb +20 -8
  82. data/lib/action_view.rb +5 -5
  83. data/lib/assets/compiled/rails-ujs.js +683 -0
  84. metadata +18 -12
@@ -1,4 +1,4 @@
1
- require 'action_view/helpers/tags/collection_helpers'
1
+ require "action_view/helpers/tags/collection_helpers"
2
2
 
3
3
  module ActionView
4
4
  module Helpers
@@ -7,9 +7,10 @@ module ActionView
7
7
  include CollectionHelpers
8
8
 
9
9
  class CheckBoxBuilder < Builder # :nodoc:
10
- def check_box(extra_html_options={})
10
+ def check_box(extra_html_options = {})
11
11
  html_options = extra_html_options.merge(@input_html_options)
12
12
  html_options[:multiple] = true
13
+ html_options[:skip_default_ids] = false
13
14
  @template_object.check_box(@object_name, @method_name, html_options, @value, nil)
14
15
  end
15
16
  end
@@ -20,13 +21,13 @@ module ActionView
20
21
 
21
22
  private
22
23
 
23
- def render_component(builder)
24
- builder.check_box + builder.label
25
- end
24
+ def render_component(builder)
25
+ builder.check_box + builder.label
26
+ end
26
27
 
27
- def hidden_field_name #:nodoc:
28
- "#{super}[]"
29
- end
28
+ def hidden_field_name
29
+ "#{super}[]"
30
+ end
30
31
  end
31
32
  end
32
33
  end
@@ -17,7 +17,7 @@ module ActionView
17
17
  @input_html_options = input_html_options
18
18
  end
19
19
 
20
- def label(label_html_options={}, &block)
20
+ def label(label_html_options = {}, &block)
21
21
  html_options = @input_html_options.slice(:index, :namespace).merge(label_html_options)
22
22
  html_options[:for] ||= @input_html_options[:id] if @input_html_options[:id]
23
23
 
@@ -36,81 +36,81 @@ module ActionView
36
36
 
37
37
  private
38
38
 
39
- def instantiate_builder(builder_class, item, value, text, html_options)
40
- builder_class.new(@template_object, @object_name, @method_name, item,
41
- sanitize_attribute_name(value), text, value, html_options)
42
- end
43
-
44
- # Generate default options for collection helpers, such as :checked and
45
- # :disabled.
46
- def default_html_options_for_collection(item, value) #:nodoc:
47
- html_options = @html_options.dup
48
-
49
- [:checked, :selected, :disabled, :readonly].each do |option|
50
- current_value = @options[option]
51
- next if current_value.nil?
39
+ def instantiate_builder(builder_class, item, value, text, html_options)
40
+ builder_class.new(@template_object, @object_name, @method_name, item,
41
+ sanitize_attribute_name(value), text, value, html_options)
42
+ end
52
43
 
53
- accept = if current_value.respond_to?(:call)
54
- current_value.call(item)
55
- else
56
- Array(current_value).map(&:to_s).include?(value.to_s)
44
+ # Generate default options for collection helpers, such as :checked and
45
+ # :disabled.
46
+ def default_html_options_for_collection(item, value)
47
+ html_options = @html_options.dup
48
+
49
+ [:checked, :selected, :disabled, :readonly].each do |option|
50
+ current_value = @options[option]
51
+ next if current_value.nil?
52
+
53
+ accept = if current_value.respond_to?(:call)
54
+ current_value.call(item)
55
+ else
56
+ Array(current_value).map(&:to_s).include?(value.to_s)
57
+ end
58
+
59
+ if accept
60
+ html_options[option] = true
61
+ elsif option == :checked
62
+ html_options[option] = false
63
+ end
57
64
  end
58
65
 
59
- if accept
60
- html_options[option] = true
61
- elsif option == :checked
62
- html_options[option] = false
63
- end
66
+ html_options[:object] = @object
67
+ html_options
64
68
  end
65
69
 
66
- html_options[:object] = @object
67
- html_options
68
- end
70
+ def sanitize_attribute_name(value)
71
+ "#{sanitized_method_name}_#{sanitized_value(value)}"
72
+ end
69
73
 
70
- def sanitize_attribute_name(value) #:nodoc:
71
- "#{sanitized_method_name}_#{sanitized_value(value)}"
72
- end
74
+ def render_collection
75
+ @collection.map do |item|
76
+ value = value_for_collection(item, @value_method)
77
+ text = value_for_collection(item, @text_method)
78
+ default_html_options = default_html_options_for_collection(item, value)
79
+ additional_html_options = option_html_attributes(item)
73
80
 
74
- def render_collection #:nodoc:
75
- @collection.map do |item|
76
- value = value_for_collection(item, @value_method)
77
- text = value_for_collection(item, @text_method)
78
- default_html_options = default_html_options_for_collection(item, value)
79
- additional_html_options = option_html_attributes(item)
81
+ yield item, value, text, default_html_options.merge(additional_html_options)
82
+ end.join.html_safe
83
+ end
80
84
 
81
- yield item, value, text, default_html_options.merge(additional_html_options)
82
- end.join.html_safe
83
- end
85
+ def render_collection_for(builder_class, &block)
86
+ options = @options.stringify_keys
87
+ rendered_collection = render_collection do |item, value, text, default_html_options|
88
+ builder = instantiate_builder(builder_class, item, value, text, default_html_options)
84
89
 
85
- def render_collection_for(builder_class, &block) #:nodoc:
86
- options = @options.stringify_keys
87
- rendered_collection = render_collection do |item, value, text, default_html_options|
88
- builder = instantiate_builder(builder_class, item, value, text, default_html_options)
90
+ if block_given?
91
+ @template_object.capture(builder, &block)
92
+ else
93
+ render_component(builder)
94
+ end
95
+ end
89
96
 
90
- if block_given?
91
- @template_object.capture(builder, &block)
97
+ # Prepend a hidden field to make sure something will be sent back to the
98
+ # server if all radio buttons are unchecked.
99
+ if options.fetch("include_hidden", true)
100
+ hidden_field + rendered_collection
92
101
  else
93
- render_component(builder)
102
+ rendered_collection
94
103
  end
95
104
  end
96
105
 
97
- # Prepend a hidden field to make sure something will be sent back to the
98
- # server if all radio buttons are unchecked.
99
- if options.fetch('include_hidden', true)
100
- hidden_field + rendered_collection
101
- else
102
- rendered_collection
106
+ def hidden_field
107
+ hidden_name = @html_options[:name] || hidden_field_name
108
+ @template_object.hidden_field_tag(hidden_name, "", id: nil)
103
109
  end
104
- end
105
110
 
106
- def hidden_field #:nodoc:
107
- hidden_name = @html_options[:name] || hidden_field_name
108
- @template_object.hidden_field_tag(hidden_name, "", id: nil)
109
- end
110
-
111
- def hidden_field_name #:nodoc:
112
- "#{tag_name(false, @options[:index])}"
113
- end
111
+ def hidden_field_name
112
+ "#{tag_name(false, @options[:index])}"
113
+ end
114
114
  end
115
115
  end
116
116
  end
@@ -1,4 +1,4 @@
1
- require 'action_view/helpers/tags/collection_helpers'
1
+ require "action_view/helpers/tags/collection_helpers"
2
2
 
3
3
  module ActionView
4
4
  module Helpers
@@ -7,8 +7,9 @@ module ActionView
7
7
  include CollectionHelpers
8
8
 
9
9
  class RadioButtonBuilder < Builder # :nodoc:
10
- def radio_button(extra_html_options={})
10
+ def radio_button(extra_html_options = {})
11
11
  html_options = extra_html_options.merge(@input_html_options)
12
+ html_options[:skip_default_ids] = false
12
13
  @template_object.radio_button(@object_name, @method_name, @value, html_options)
13
14
  end
14
15
  end
@@ -13,8 +13,8 @@ module ActionView
13
13
 
14
14
  def render
15
15
  option_tags_options = {
16
- :selected => @options.fetch(:selected) { value(@object) },
17
- :disabled => @options[:disabled]
16
+ selected: @options.fetch(:selected) { value(@object) },
17
+ disabled: @options[:disabled]
18
18
  }
19
19
 
20
20
  select_content_tag(
@@ -1,4 +1,4 @@
1
- require 'active_support/core_ext/time/calculations'
1
+ require "active_support/core_ext/time/calculations"
2
2
 
3
3
  module ActionView
4
4
  module Helpers
@@ -16,56 +16,56 @@ module ActionView
16
16
 
17
17
  class << self
18
18
  def select_type
19
- @select_type ||= self.name.split("::").last.sub("Select", "").downcase
19
+ @select_type ||= name.split("::").last.sub("Select", "").downcase
20
20
  end
21
21
  end
22
22
 
23
23
  private
24
24
 
25
- def select_type
26
- self.class.select_type
27
- end
25
+ def select_type
26
+ self.class.select_type
27
+ end
28
28
 
29
- def datetime_selector(options, html_options)
30
- datetime = options.fetch(:selected) { value(object) || default_datetime(options) }
31
- @auto_index ||= nil
29
+ def datetime_selector(options, html_options)
30
+ datetime = options.fetch(:selected) { value(object) || default_datetime(options) }
31
+ @auto_index ||= nil
32
32
 
33
- options = options.dup
34
- options[:field_name] = @method_name
35
- options[:include_position] = true
36
- options[:prefix] ||= @object_name
37
- options[:index] = @auto_index if @auto_index && !options.has_key?(:index)
33
+ options = options.dup
34
+ options[:field_name] = @method_name
35
+ options[:include_position] = true
36
+ options[:prefix] ||= @object_name
37
+ options[:index] = @auto_index if @auto_index && !options.has_key?(:index)
38
38
 
39
- DateTimeSelector.new(datetime, options, html_options)
40
- end
39
+ DateTimeSelector.new(datetime, options, html_options)
40
+ end
41
41
 
42
- def default_datetime(options)
43
- return if options[:include_blank] || options[:prompt]
42
+ def default_datetime(options)
43
+ return if options[:include_blank] || options[:prompt]
44
44
 
45
- case options[:default]
46
- when nil
47
- Time.current
48
- when Date, Time
49
- options[:default]
50
- else
51
- default = options[:default].dup
45
+ case options[:default]
46
+ when nil
47
+ Time.current
48
+ when Date, Time
49
+ options[:default]
50
+ else
51
+ default = options[:default].dup
52
52
 
53
- # Rename :minute and :second to :min and :sec
54
- default[:min] ||= default[:minute]
55
- default[:sec] ||= default[:second]
53
+ # Rename :minute and :second to :min and :sec
54
+ default[:min] ||= default[:minute]
55
+ default[:sec] ||= default[:second]
56
56
 
57
- time = Time.current
57
+ time = Time.current
58
58
 
59
- [:year, :month, :day, :hour, :min, :sec].each do |key|
60
- default[key] ||= time.send(key)
61
- end
59
+ [:year, :month, :day, :hour, :min, :sec].each do |key|
60
+ default[key] ||= time.send(key)
61
+ end
62
62
 
63
- Time.utc(
64
- default[:year], default[:month], default[:day],
65
- default[:hour], default[:min], default[:sec]
66
- )
63
+ Time.utc(
64
+ default[:year], default[:month], default[:day],
65
+ default[:hour], default[:min], default[:sec]
66
+ )
67
+ end
67
68
  end
68
- end
69
69
  end
70
70
  end
71
71
  end
@@ -15,8 +15,8 @@ module ActionView
15
15
 
16
16
  def render
17
17
  option_tags_options = {
18
- :selected => @options.fetch(:selected) { value(@object) },
19
- :disabled => @options[:disabled]
18
+ selected: @options.fetch(:selected) { value(@object) },
19
+ disabled: @options[:disabled]
20
20
  }
21
21
 
22
22
  select_content_tag(
@@ -73,6 +73,10 @@ module ActionView
73
73
  def render_component(builder)
74
74
  builder.translation
75
75
  end
76
+
77
+ def skip_default_ids?
78
+ false # The id is used as the `for` attribute.
79
+ end
76
80
  end
77
81
  end
78
82
  end
@@ -3,7 +3,7 @@ module ActionView
3
3
  module Tags # :nodoc:
4
4
  class PasswordField < TextField # :nodoc:
5
5
  def render
6
- @options = {:value => nil}.merge!(@options)
6
+ @options = { value: nil }.merge!(@options)
7
7
  super
8
8
  end
9
9
  end
@@ -1,4 +1,4 @@
1
- require 'action_view/helpers/tags/checkable'
1
+ require "action_view/helpers/tags/checkable"
2
2
 
3
3
  module ActionView
4
4
  module Helpers
@@ -22,9 +22,9 @@ module ActionView
22
22
 
23
23
  private
24
24
 
25
- def checked?(value)
26
- value.to_s == @tag_value.to_s
27
- end
25
+ def checked?(value)
26
+ value.to_s == @tag_value.to_s
27
+ end
28
28
  end
29
29
  end
30
30
  end
@@ -13,8 +13,8 @@ module ActionView
13
13
 
14
14
  def render
15
15
  option_tags_options = {
16
- :selected => @options.fetch(:selected) { value(@object) },
17
- :disabled => @options[:disabled]
16
+ selected: @options.fetch(:selected) { value(@object) },
17
+ disabled: @options[:disabled]
18
18
  }
19
19
 
20
20
  option_tags = if grouped_choices?
@@ -28,13 +28,13 @@ module ActionView
28
28
 
29
29
  private
30
30
 
31
- # Grouped choices look like this:
32
- #
33
- # [nil, []]
34
- # { nil => [] }
35
- def grouped_choices?
36
- !@choices.empty? && @choices.first.respond_to?(:last) && Array === @choices.first.last
37
- end
31
+ # Grouped choices look like this:
32
+ #
33
+ # [nil, []]
34
+ # { nil => [] }
35
+ def grouped_choices?
36
+ !@choices.empty? && @choices.first.respond_to?(:last) && Array === @choices.first.last
37
+ end
38
38
  end
39
39
  end
40
40
  end
@@ -1,4 +1,4 @@
1
- require 'action_view/helpers/tags/placeholderable'
1
+ require "action_view/helpers/tags/placeholderable"
2
2
 
3
3
  module ActionView
4
4
  module Helpers
@@ -1,4 +1,4 @@
1
- require 'action_view/helpers/tags/placeholderable'
1
+ require "action_view/helpers/tags/placeholderable"
2
2
 
3
3
  module ActionView
4
4
  module Helpers
@@ -17,15 +17,15 @@ module ActionView
17
17
 
18
18
  class << self
19
19
  def field_type
20
- @field_type ||= self.name.split("::").last.sub("Field", "").downcase
20
+ @field_type ||= name.split("::").last.sub("Field", "").downcase
21
21
  end
22
22
  end
23
23
 
24
24
  private
25
25
 
26
- def field_type
27
- self.class.field_type
28
- end
26
+ def field_type
27
+ self.class.field_type
28
+ end
29
29
  end
30
30
  end
31
31
  end
@@ -14,26 +14,28 @@ module ActionView
14
14
  translated_attribute || human_attribute_name
15
15
  end
16
16
 
17
+ # TODO Change this to private once we've dropped Ruby 2.2 support.
18
+ # Workaround for Ruby 2.2 "private attribute?" warning.
17
19
  protected
18
20
 
19
- attr_reader :object_name, :method_and_value, :scope, :model
21
+ attr_reader :object_name, :method_and_value, :scope, :model
20
22
 
21
23
  private
22
24
 
23
- def i18n_default
24
- if model
25
- key = model.model_name.i18n_key
26
- ["#{key}.#{method_and_value}".to_sym, ""]
27
- else
28
- ""
25
+ def i18n_default
26
+ if model
27
+ key = model.model_name.i18n_key
28
+ ["#{key}.#{method_and_value}".to_sym, ""]
29
+ else
30
+ ""
31
+ end
29
32
  end
30
- end
31
33
 
32
- def human_attribute_name
33
- if model && model.class.respond_to?(:human_attribute_name)
34
- model.class.human_attribute_name(method_and_value)
34
+ def human_attribute_name
35
+ if model && model.class.respond_to?(:human_attribute_name)
36
+ model.class.human_attribute_name(method_and_value)
37
+ end
35
38
  end
36
- end
37
39
  end
38
40
  end
39
41
  end
@@ -1,5 +1,5 @@
1
- require 'active_support/core_ext/string/filters'
2
- require 'active_support/core_ext/array/extract_options'
1
+ require "active_support/core_ext/string/filters"
2
+ require "active_support/core_ext/array/extract_options"
3
3
 
4
4
  module ActionView
5
5
  # = Action View Text Helpers
@@ -135,7 +135,7 @@ module ActionView
135
135
  else
136
136
  match = Array(phrases).map do |p|
137
137
  Regexp === p ? p.to_s : Regexp.escape(p)
138
- end.join('|')
138
+ end.join("|")
139
139
 
140
140
  if block_given?
141
141
  text.gsub(/(#{match})(?![^<]*?>)/i) { |found| yield found }
@@ -151,7 +151,7 @@ module ActionView
151
151
  # defined in <tt>:radius</tt> (which defaults to 100). If the excerpt radius overflows the beginning or end of the +text+,
152
152
  # then the <tt>:omission</tt> option (which defaults to "...") will be prepended/appended accordingly. Use the
153
153
  # <tt>:separator</tt> option to choose the delimitation. The resulting string will be stripped in any case. If the +phrase+
154
- # isn't found, nil is returned.
154
+ # isn't found, +nil+ is returned.
155
155
  #
156
156
  # excerpt('This is an example', 'an', radius: 5)
157
157
  # # => ...s is an exam...
@@ -187,7 +187,7 @@ module ActionView
187
187
  unless separator.empty?
188
188
  text.split(separator).each do |value|
189
189
  if value.match(regex)
190
- regex = phrase = value
190
+ phrase = value
191
191
  break
192
192
  end
193
193
  end
@@ -262,10 +262,11 @@ module ActionView
262
262
  end
263
263
 
264
264
  # Returns +text+ transformed into HTML using simple formatting rules.
265
- # Two or more consecutive newlines(<tt>\n\n</tt>) are considered as a
266
- # paragraph and wrapped in <tt><p></tt> tags. One newline (<tt>\n</tt>) is
267
- # considered as a linebreak and a <tt><br /></tt> tag is appended. This
268
- # method does not remove the newlines from the +text+.
265
+ # Two or more consecutive newlines(<tt>\n\n</tt> or <tt>\r\n\r\n</tt>) are
266
+ # considered a paragraph and wrapped in <tt><p></tt> tags. One newline
267
+ # (<tt>\n</tt> or <tt>\r\n</tt>) is considered a linebreak and a
268
+ # <tt><br /></tt> tag is appended. This method does not remove the
269
+ # newlines from the +text+.
269
270
  #
270
271
  # You can pass any HTML attributes into <tt>html_options</tt>. These
271
272
  # will be added to all created paragraphs.
@@ -350,7 +351,7 @@ module ActionView
350
351
  # <% end %>
351
352
  def cycle(first_value, *values)
352
353
  options = values.extract_options!
353
- name = options.fetch(:name, 'default')
354
+ name = options.fetch(:name, "default")
354
355
 
355
356
  values.unshift(*first_value)
356
357
 
@@ -424,17 +425,17 @@ module ActionView
424
425
 
425
426
  private
426
427
 
427
- def next_index
428
- step_index(1)
429
- end
428
+ def next_index
429
+ step_index(1)
430
+ end
430
431
 
431
- def previous_index
432
- step_index(-1)
433
- end
432
+ def previous_index
433
+ step_index(-1)
434
+ end
434
435
 
435
- def step_index(n)
436
- (@index + n) % @values.size
437
- end
436
+ def step_index(n)
437
+ (@index + n) % @values.size
438
+ end
438
439
  end
439
440
 
440
441
  private
@@ -1,6 +1,6 @@
1
- require 'action_view/helpers/tag_helper'
2
- require 'active_support/core_ext/string/access'
3
- require 'i18n/exceptions'
1
+ require "action_view/helpers/tag_helper"
2
+ require "active_support/core_ext/string/access"
3
+ require "i18n/exceptions"
4
4
 
5
5
  module ActionView
6
6
  # = Action View Translation Helpers
@@ -100,12 +100,12 @@ module ActionView
100
100
 
101
101
  interpolations = options.except(:default, :scope)
102
102
  if interpolations.any?
103
- title << ", " << interpolations.map { |k, v| "#{k}: #{ERB::Util.html_escape(v)}" }.join(', ')
103
+ title << ", " << interpolations.map { |k, v| "#{k}: #{ERB::Util.html_escape(v)}" }.join(", ")
104
104
  end
105
105
 
106
106
  return title unless ActionView::Base.debug_missing_translation
107
107
 
108
- content_tag('span', keys.last.to_s.titleize, class: 'translation_missing', title: title)
108
+ content_tag("span", keys.last.to_s.titleize, class: "translation_missing", title: title)
109
109
  end
110
110
  end
111
111
  alias :t :translate
@@ -133,7 +133,7 @@ module ActionView
133
133
  end
134
134
 
135
135
  def html_safe_translation_key?(key)
136
- key.to_s =~ /(\b|_|\.)html$/
136
+ /(\b|_|\.)html$/.match?(key.to_s)
137
137
  end
138
138
  end
139
139
  end