actionview 5.0.0.beta1.1 → 5.0.0.beta2

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76116781d2e7e87d011ef7bc50aa9e16c821c21d
4
- data.tar.gz: 8a5378c1c8a1163f2937642492144c5777030332
3
+ metadata.gz: 5ed6df64a978ea67512f762566f43c03720d81f6
4
+ data.tar.gz: c434b674c12d95e5a19b5afc49013000db74122d
5
5
  SHA512:
6
- metadata.gz: 1cf10241b15afb78e1d3326d10f632dd8e9a3adc1ccd1ad34d54cc1128cd2604c00537fb1d039e54aa966cbe9ce6e34c66d90a3a5a2bb82b709f5ea8debb6914
7
- data.tar.gz: dc548becb90858c6a682b0d66c2f1acabe7fa2dd0db55fd08fbc6f30617c9f0898211c449b4845093632fcfc2cdff7ffde22df1a853128b2c5182d06befb2404
6
+ metadata.gz: e1a742c7151ec8d4699923321e139ff293a19202e595f4748b465791dbacc032bc602cc572b36eb3fdebb01fa580ea673dd48ffb9144e8f341a349a9e9d99675
7
+ data.tar.gz: 85487efbb9f882f2cf8f0bb7cca78fc95e4c1171ef502ecabd7c20ccf85c430c1457afeb8083a1dbbb9d12e489cc37eada7e004e5ecd148c674526bbb107c672
@@ -1,14 +1,42 @@
1
- ## Rails 5.0.0.beta1 (December 18, 2015) ##
1
+ ## Rails 5.0.0.beta2 (February 01, 2016) ##
2
+
3
+ * Fix stripping the digest from the automatically generated img tag alt
4
+ attribute when assets are handled by Sprockets >=3.0.
5
+
6
+ *Bart de Water*
7
+
8
+ * Create a new `ActiveSupport::SafeBuffer` instance when `content_for` is flushed.
9
+
10
+ Fixes #19890
11
+
12
+ *Yoong Kang Lim*
13
+
14
+ * Fix `collection_radio_buttons` hidden_field name and make it appear
15
+ before the actual input radio tags to make the real value override
16
+ the hidden when passed.
17
+
18
+ Fixes #22773.
2
19
 
3
- * No changes.
20
+ *Santiago Pastorino*
4
21
 
22
+ * `ActionView::TestCase::Controller#params` returns an instance of
23
+ `ActionController::Parameters`.
24
+
25
+ *Justin Coyne*
26
+
27
+ * Fix regression in `submit_tag` when a symbol is used as label argument.
28
+
29
+ *Yuuji Yaginuma*
30
+
31
+
32
+ ## Rails 5.0.0.beta1 (December 18, 2015) ##
5
33
 
6
34
  * `I18n.translate` helper will wrap the missing translation keys
7
35
  in a <span> tag only if `debug_missing_translation` configuration
8
36
  be true. Default value is `true`. For example in `application.rb`:
9
37
 
10
38
  # in order to turn off missing key wrapping
11
- config.action_view.debug_missing_tranlation = false
39
+ config.action_view.debug_missing_translation = false
12
40
 
13
41
  *Sameer Rahmani*
14
42
 
@@ -100,7 +128,7 @@
100
128
  Which could happen if the rendering was done directly in the controller
101
129
  and not in a template.
102
130
 
103
- Fixes #20535
131
+ Fixes #20535.
104
132
 
105
133
  *Roque Pinel*
106
134
 
@@ -109,7 +137,7 @@
109
137
 
110
138
  *Dov Murik*
111
139
 
112
- * Raise an ArgumentError when a false value for `include_blank` is passed to a
140
+ * Raise an `ArgumentError` when a false value for `include_blank` is passed to a
113
141
  required select field (to comply with the HTML5 spec).
114
142
 
115
143
  *Grey Baker*
@@ -127,7 +155,7 @@
127
155
  * `translate` should handle `raise` flag correctly in case of both main and default
128
156
  translation is missing.
129
157
 
130
- Fixes #19967
158
+ Fixes #19967.
131
159
 
132
160
  *Bernard Potocki*
133
161
 
@@ -149,7 +177,7 @@
149
177
  * `translate` should accept nils as members of the `:default`
150
178
  parameter without raising a translation missing error.
151
179
 
152
- Fixes #19419
180
+ Fixes #19419.
153
181
 
154
182
  *Justin Coyne*
155
183
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2015 David Heinemeier Hansson
1
+ Copyright (c) 2004-2016 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2004-2015 David Heinemeier Hansson
2
+ # Copyright (c) 2004-2016 David Heinemeier Hansson
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -15,7 +15,7 @@ module ActionView
15
15
 
16
16
  # Called by each renderer object to set the layout contents.
17
17
  def set(key, value)
18
- @content[key] = value
18
+ @content[key] = ActiveSupport::SafeBuffer.new(value)
19
19
  end
20
20
 
21
21
  # Called by content_for
@@ -8,7 +8,7 @@ module ActionView
8
8
  MAJOR = 5
9
9
  MINOR = 0
10
10
  TINY = 0
11
- PRE = "beta1.1"
11
+ PRE = "beta2"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -136,7 +136,7 @@ module ActionView
136
136
  tag(
137
137
  "link",
138
138
  "rel" => tag_options[:rel] || "alternate",
139
- "type" => tag_options[:type] || Mime[type].to_s,
139
+ "type" => tag_options[:type] || Template::Types[type].to_s,
140
140
  "title" => tag_options[:title] || type.to_s.upcase,
141
141
  "href" => url_options.is_a?(Hash) ? url_for(url_options.merge(:only_path => false)) : url_options
142
142
  )
@@ -239,7 +239,7 @@ module ActionView
239
239
  # image_alt('underscored_file_name.png')
240
240
  # # => Underscored file name
241
241
  def image_alt(src)
242
- File.basename(src, '.*'.freeze).sub(/-[[:xdigit:]]{32}\z/, ''.freeze).tr('-_'.freeze, ' '.freeze).capitalize
242
+ File.basename(src, '.*'.freeze).sub(/-[[:xdigit:]]{32,64}\z/, ''.freeze).tr('-_'.freeze, ' '.freeze).capitalize
243
243
  end
244
244
 
245
245
  # Returns an HTML video tag for the +sources+. If +sources+ is a string,
@@ -51,7 +51,7 @@ module ActionView
51
51
  # * <tt>:language</tt>: Defaults to "en-US".
52
52
  # * <tt>:root_url</tt>: The HTML alternative that this feed is doubling for. Defaults to / on the current host.
53
53
  # * <tt>:url</tt>: The URL for this feed. Defaults to the current URL.
54
- # * <tt>:id</tt>: The id for this feed. Defaults to "tag:localhost,2005:/posts", in this case.
54
+ # * <tt>:id</tt>: The id for this feed. Defaults to "tag:localhost,2005:/posts", in this case.
55
55
  # * <tt>:schema_date</tt>: The date at which the tag scheme for the feed was first used. A good default is the year you
56
56
  # created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information. If not specified,
57
57
  # 2005 is used (as an "I don't care" value).
@@ -166,7 +166,8 @@ module ActionView
166
166
  # You can only declare one collection in a partial template file.
167
167
  def cache(name = {}, options = {}, &block)
168
168
  if controller.respond_to?(:perform_caching) && controller.perform_caching
169
- safe_concat(fragment_for(cache_fragment_name(name, options), options, &block))
169
+ name_options = options.slice(:skip_digest, :virtual_path)
170
+ safe_concat(fragment_for(cache_fragment_name(name, name_options), options, &block))
170
171
  else
171
172
  yield
172
173
  end
@@ -9,8 +9,8 @@ module ActionView
9
9
  # It provides a method to capture blocks into variables through capture and
10
10
  # a way to capture a block of markup for use in a layout through content_for.
11
11
  module CaptureHelper
12
- # The capture method allows you to extract part of a template into a
13
- # variable. You can then use this variable anywhere in your templates or layout.
12
+ # The capture method extracts part of a template as a String object.
13
+ # You can then use this object anywhere in your templates, layout, or helpers.
14
14
  #
15
15
  # The capture method can be used in ERB templates...
16
16
  #
@@ -765,7 +765,7 @@ module ActionView
765
765
  # # => <label for="post_privacy_public">Public Post</label>
766
766
  #
767
767
  # label(:post, :terms) do
768
- # 'Accept <a href="/terms">Terms</a>.'.html_safe
768
+ # raw('Accept <a href="/terms">Terms</a>.')
769
769
  # end
770
770
  # # => <label for="post_terms">Accept <a href="/terms">Terms</a>.</label>
771
771
  def label(object_name, method, content_or_options = nil, options = nil, &block)
@@ -1675,7 +1675,7 @@ module ActionView
1675
1675
  # # => <label for="post_privacy_public">Public Post</label>
1676
1676
  #
1677
1677
  # label(:terms) do
1678
- # 'Accept <a href="/terms">Terms</a>.'.html_safe
1678
+ # raw('Accept <a href="/terms">Terms</a>.')
1679
1679
  # end
1680
1680
  # # => <label for="post_terms">Accept <a href="/terms">Terms</a>.</label>
1681
1681
  def label(method, text = nil, options = {}, &block)
@@ -1922,6 +1922,8 @@ module ActionView
1922
1922
  @object_name.to_s.humanize
1923
1923
  end
1924
1924
 
1925
+ model = model.downcase
1926
+
1925
1927
  defaults = []
1926
1928
  defaults << :"helpers.submit.#{object_name}.#{key}"
1927
1929
  defaults << :"helpers.submit.#{key}"
@@ -93,22 +93,22 @@ module ActionView
93
93
  # select_tag "people", options_from_collection_for_select(@people, "id", "name", "1")
94
94
  # # <select id="people" name="people"><option value="1" selected="selected">David</option></select>
95
95
  #
96
- # select_tag "people", "<option>David</option>".html_safe
96
+ # select_tag "people", raw("<option>David</option>")
97
97
  # # => <select id="people" name="people"><option>David</option></select>
98
98
  #
99
- # select_tag "count", "<option>1</option><option>2</option><option>3</option><option>4</option>".html_safe
99
+ # select_tag "count", raw("<option>1</option><option>2</option><option>3</option><option>4</option>")
100
100
  # # => <select id="count" name="count"><option>1</option><option>2</option>
101
101
  # # <option>3</option><option>4</option></select>
102
102
  #
103
- # select_tag "colors", "<option>Red</option><option>Green</option><option>Blue</option>".html_safe, multiple: true
103
+ # select_tag "colors", raw("<option>Red</option><option>Green</option><option>Blue</option>"), multiple: true
104
104
  # # => <select id="colors" multiple="multiple" name="colors[]"><option>Red</option>
105
105
  # # <option>Green</option><option>Blue</option></select>
106
106
  #
107
- # select_tag "locations", "<option>Home</option><option selected='selected'>Work</option><option>Out</option>".html_safe
107
+ # select_tag "locations", raw("<option>Home</option><option selected='selected'>Work</option><option>Out</option>")
108
108
  # # => <select id="locations" name="locations"><option>Home</option><option selected='selected'>Work</option>
109
109
  # # <option>Out</option></select>
110
110
  #
111
- # select_tag "access", "<option>Read</option><option>Write</option>".html_safe, multiple: true, class: 'form_input', id: 'unique_id'
111
+ # select_tag "access", raw("<option>Read</option><option>Write</option>"), multiple: true, class: 'form_input', id: 'unique_id'
112
112
  # # => <select class="form_input" id="unique_id" multiple="multiple" name="access[]"><option>Read</option>
113
113
  # # <option>Write</option></select>
114
114
  #
@@ -121,7 +121,7 @@ module ActionView
121
121
  # select_tag "people", options_from_collection_for_select(@people, "id", "name"), prompt: "Select something"
122
122
  # # => <select id="people" name="people"><option value="">Select something</option><option value="1">David</option></select>
123
123
  #
124
- # select_tag "destination", "<option>NYC</option><option>Paris</option><option>Rome</option>".html_safe, disabled: true
124
+ # select_tag "destination", raw("<option>NYC</option><option>Paris</option><option>Rome</option>"), disabled: true
125
125
  # # => <select disabled="disabled" id="destination" name="destination"><option>NYC</option>
126
126
  # # <option>Paris</option><option>Rome</option></select>
127
127
  #
@@ -447,7 +447,7 @@ module ActionView
447
447
  unless tag_options["data-disable-with"] == false || (tag_options["data"] && tag_options["data"][:disable_with] == false)
448
448
  disable_with_text = tag_options["data-disable-with"]
449
449
  disable_with_text ||= tag_options["data"][:disable_with] if tag_options["data"]
450
- disable_with_text ||= value.clone
450
+ disable_with_text ||= value.to_s.clone
451
451
  tag_options.deep_merge!("data" => { "disable_with" => disable_with_text })
452
452
  else
453
453
  tag_options["data"].delete(:disable_with) if tag_options["data"]
@@ -870,10 +870,16 @@ module ActionView
870
870
  ''
871
871
  when /^post$/i, "", nil
872
872
  html_options["method"] = "post"
873
- token_tag(authenticity_token)
873
+ token_tag(authenticity_token, form_options: {
874
+ action: html_options["action"],
875
+ method: "post"
876
+ })
874
877
  else
875
878
  html_options["method"] = "post"
876
- method_tag(method) + token_tag(authenticity_token)
879
+ method_tag(method) + token_tag(authenticity_token, form_options: {
880
+ action: html_options["action"],
881
+ method: method
882
+ })
877
883
  end
878
884
 
879
885
  if html_options.delete("enforce_utf8") { true }
@@ -63,6 +63,14 @@ module ActionView
63
63
  # Formats a +number+ into a currency string (e.g., $13.65). You
64
64
  # can customize the format in the +options+ hash.
65
65
  #
66
+ # The currency unit and number formatting of the current locale will be used
67
+ # unless otherwise specified in the provided options. No currency conversion
68
+ # is performed. If the user is given a way to change their locale, they will
69
+ # also be able to change the relative value of the currency displayed with
70
+ # this helper. If your application will ever support multiple locales, you
71
+ # may want to specify a constant <tt>:locale</tt> option or consider
72
+ # using a library capable of currency conversion.
73
+ #
66
74
  # ==== Options
67
75
  #
68
76
  # * <tt>:locale</tt> - Sets the locale to be used for formatting
@@ -261,6 +269,8 @@ module ActionView
261
269
  # number_to_human_size(1234567) # => 1.18 MB
262
270
  # number_to_human_size(1234567890) # => 1.15 GB
263
271
  # number_to_human_size(1234567890123) # => 1.12 TB
272
+ # number_to_human_size(1234567890123456) # => 1.1 PB
273
+ # number_to_human_size(1234567890123456789) # => 1.07 EB
264
274
  # number_to_human_size(1234567, precision: 2) # => 1.2 MB
265
275
  # number_to_human_size(483989, precision: 2) # => 470 KB
266
276
  # number_to_human_size(1234567, precision: 2, separator: ',') # => 1,2 MB
@@ -22,10 +22,10 @@ module ActionView #:nodoc:
22
22
  # the supplied separator, are HTML escaped unless they are HTML
23
23
  # safe, and the returned string is marked as HTML safe.
24
24
  #
25
- # safe_join(["<p>foo</p>".html_safe, "<p>bar</p>"], "<br />")
25
+ # safe_join([raw("<p>foo</p>"), "<p>bar</p>"], "<br />")
26
26
  # # => "<p>foo</p>&lt;br /&gt;&lt;p&gt;bar&lt;/p&gt;"
27
27
  #
28
- # safe_join(["<p>foo</p>".html_safe, "<p>bar</p>".html_safe], "<br />".html_safe)
28
+ # safe_join([raw("<p>foo</p>"), raw("<p>bar</p>")], raw("<br />")
29
29
  # # => "<p>foo</p><br /><p>bar</p>"
30
30
  #
31
31
  def safe_join(array, sep=$,)
@@ -23,6 +23,10 @@ module ActionView
23
23
  def render_component(builder)
24
24
  builder.check_box + builder.label
25
25
  end
26
+
27
+ def hidden_field_name #:nodoc:
28
+ "#{super}[]"
29
+ end
26
30
  end
27
31
  end
28
32
  end
@@ -94,19 +94,23 @@ module ActionView
94
94
  end
95
95
  end
96
96
 
97
- # Append a hidden field to make sure something will be sent back to the
97
+ # Prepend a hidden field to make sure something will be sent back to the
98
98
  # server if all radio buttons are unchecked.
99
99
  if options.fetch('include_hidden', true)
100
- rendered_collection + hidden_field
100
+ hidden_field + rendered_collection
101
101
  else
102
102
  rendered_collection
103
103
  end
104
104
  end
105
105
 
106
106
  def hidden_field #:nodoc:
107
- hidden_name = @html_options[:name] || "#{tag_name(false, @options[:index])}[]"
107
+ hidden_name = @html_options[:name] || hidden_field_name
108
108
  @template_object.hidden_field_tag(hidden_name, "", id: nil)
109
109
  end
110
+
111
+ def hidden_field_name #:nodoc:
112
+ "#{tag_name(false, @options[:index])}"
113
+ end
110
114
  end
111
115
  end
112
116
  end
@@ -204,12 +204,12 @@ module ActionView
204
204
 
205
205
  # Attempts to pluralize the +singular+ word unless +count+ is 1. If
206
206
  # +plural+ is supplied, it will use that when count is > 1, otherwise
207
- # it will use the Inflector to determine the plural form.
207
+ # it will use the Inflector to determine the plural form for the given locale,
208
+ # which defaults to I18n.locale
208
209
  #
209
- # If passed an optional +locale:+ parameter, the word will be pluralized
210
- # using rules defined for that language (you must define your own
211
- # inflection rules for languages other than English). See
212
- # ActiveSupport::Inflector.pluralize
210
+ # The word will be pluralized using rules defined for the locale
211
+ # (you must define your own inflection rules for languages other than English).
212
+ # See ActiveSupport::Inflector.pluralize
213
213
  #
214
214
  # pluralize(1, 'person')
215
215
  # # => 1 person
@@ -217,7 +217,7 @@ module ActionView
217
217
  # pluralize(2, 'person')
218
218
  # # => 2 people
219
219
  #
220
- # pluralize(3, 'person', 'users')
220
+ # pluralize(3, 'person', plural: 'users')
221
221
  # # => 3 users
222
222
  #
223
223
  # pluralize(0, 'person')
@@ -225,7 +225,14 @@ module ActionView
225
225
  #
226
226
  # pluralize(2, 'Person', locale: :de)
227
227
  # # => 2 Personen
228
- def pluralize(count, singular, plural = nil, locale: nil)
228
+ def pluralize(count, singular, deprecated_plural = nil, plural: nil, locale: I18n.locale)
229
+ if deprecated_plural
230
+ ActiveSupport::Deprecation.warn("Passing plural as a positional argument " \
231
+ "is deprecated and will be removed in Rails 5.1. Use e.g. " \
232
+ "pluralize(1, 'person', plural: 'people') instead.")
233
+ plural ||= deprecated_plural
234
+ end
235
+
229
236
  word = if (count == 1 || count =~ /^1(\.0+)?$/)
230
237
  singular
231
238
  else
@@ -311,7 +311,11 @@ module ActionView
311
311
  form_options[:action] = url
312
312
  form_options[:'data-remote'] = true if remote
313
313
 
314
- request_token_tag = form_method == 'post' ? token_tag : ''
314
+ request_token_tag = if form_method == 'post'
315
+ token_tag(nil, form_options: form_options)
316
+ else
317
+ ''
318
+ end
315
319
 
316
320
  html_options = convert_options_to_data_attributes(options, html_options)
317
321
  html_options['type'] = 'submit'
@@ -579,9 +583,9 @@ module ActionView
579
583
  html_options["data-method"] = method
580
584
  end
581
585
 
582
- def token_tag(token=nil)
586
+ def token_tag(token=nil, form_options: {})
583
587
  if token != false && protect_against_forgery?
584
- token ||= form_authenticity_token
588
+ token ||= form_authenticity_token(form_options: form_options)
585
589
  tag(:input, type: "hidden", name: request_forgery_protection_token.to_s, value: token)
586
590
  else
587
591
  ''
@@ -67,7 +67,7 @@ module ActionView
67
67
  def self.get(details)
68
68
  if details[:formats]
69
69
  details = details.dup
70
- details[:formats] &= Mime::SET.symbols
70
+ details[:formats] &= Template::Types.symbols
71
71
  end
72
72
  @details_keys[details] ||= new
73
73
  end
@@ -5,24 +5,25 @@ module ActionView
5
5
  # RecordIdentifier encapsulates methods used by various ActionView helpers
6
6
  # to associate records with DOM elements.
7
7
  #
8
- # Consider for example the following code that displays the body of a post:
8
+ # Consider for example the following code that form of post:
9
9
  #
10
- # <%= div_for(post) do %>
11
- # <%= post.body %>
10
+ # <%= form_for(post) do |f| %>
11
+ # <%= f.text_field :body %>
12
12
  # <% end %>
13
13
  #
14
14
  # When +post+ is a new, unsaved ActiveRecord::Base instance, the resulting HTML
15
15
  # is:
16
16
  #
17
- # <div id="new_post" class="post">
18
- # </div>
17
+ # <form class="new_post" id="new_post" action="/posts" accept-charset="UTF-8" method="post">
18
+ # <input type="text" name="post[body]" id="post_body" />
19
+ # </form>
19
20
  #
20
21
  # When +post+ is a persisted ActiveRecord::Base instance, the resulting HTML
21
22
  # is:
22
23
  #
23
- # <div id="post_42" class="post">
24
- # What a wonderful world!
25
- # </div>
24
+ # <form class="edit_post" id="edit_post_42" action="/posts/42" accept-charset="UTF-8" method="post">
25
+ # <input type="text" value="What a wonderful world!" name="post[body]" id="post_body" />
26
+ # </form>
26
27
  #
27
28
  # In both cases, the +id+ and +class+ of the wrapping DOM element are
28
29
  # automatically generated, following naming conventions encapsulated by the
@@ -84,7 +84,7 @@ module ActionView
84
84
  end
85
85
 
86
86
  def rendered_format
87
- Mime[lookup_context.rendered_format]
87
+ Template::Types[lookup_context.rendered_format]
88
88
  end
89
89
 
90
90
  private
@@ -2,13 +2,15 @@ module ActionView #:nodoc:
2
2
  # = Action View Template Handlers
3
3
  class Template
4
4
  module Handlers #:nodoc:
5
+ autoload :Raw, 'action_view/template/handlers/raw'
5
6
  autoload :ERB, 'action_view/template/handlers/erb'
7
+ autoload :Html, 'action_view/template/handlers/html'
6
8
  autoload :Builder, 'action_view/template/handlers/builder'
7
- autoload :Raw, 'action_view/template/handlers/raw'
8
9
 
9
10
  def self.extended(base)
10
11
  base.register_default_template_handler :raw, Raw.new
11
12
  base.register_template_handler :erb, ERB.new
13
+ base.register_template_handler :html, Html.new
12
14
  base.register_template_handler :builder, Builder.new
13
15
  base.register_template_handler :ruby, :source.to_proc
14
16
  end
@@ -0,0 +1,9 @@
1
+ module ActionView
2
+ module Template::Handlers
3
+ class Html < Raw
4
+ def call(template)
5
+ "ActionView::OutputBuffer.new #{super}"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -2,9 +2,7 @@ module ActionView
2
2
  module Template::Handlers
3
3
  class Raw
4
4
  def call(template)
5
- escaped = template.source.gsub(':'.freeze, '\:'.freeze)
6
-
7
- '%q:' + escaped + ':;'
5
+ "#{template.source.inspect};"
8
6
  end
9
7
  end
10
8
  end
@@ -3,7 +3,7 @@ require "active_support/core_ext/class"
3
3
  require "active_support/core_ext/module/attribute_accessors"
4
4
  require "action_view/template"
5
5
  require "thread"
6
- require "concurrent"
6
+ require "concurrent/map"
7
7
 
8
8
  module ActionView
9
9
  # = Action View Resolver
@@ -5,19 +5,12 @@ module ActionView
5
5
  class Template
6
6
  class Types
7
7
  class Type
8
- cattr_accessor :types
9
- self.types = Set.new
10
-
11
- def self.register(*t)
12
- types.merge(t.map(&:to_s))
13
- end
14
-
15
- register :html, :text, :js, :css, :xml, :json
8
+ SET = Struct.new(:symbols).new([ :html, :text, :js, :css, :xml, :json ])
16
9
 
17
10
  def self.[](type)
18
- return type if type.is_a?(self)
19
-
20
- if type.is_a?(Symbol) || types.member?(type.to_s)
11
+ if type.is_a?(self)
12
+ type
13
+ else
21
14
  new(type)
22
15
  end
23
16
  end
@@ -28,16 +21,18 @@ module ActionView
28
21
  @symbol = symbol.to_sym
29
22
  end
30
23
 
31
- delegate :to_s, :to_sym, :to => :symbol
24
+ def to_s
25
+ @symbol.to_s
26
+ end
32
27
  alias to_str to_s
33
28
 
34
29
  def ref
35
- to_sym || to_s
30
+ @symbol
36
31
  end
32
+ alias to_sym ref
37
33
 
38
34
  def ==(type)
39
- return false if type.blank?
40
- symbol.to_sym == type.to_sym
35
+ @symbol == type.to_sym unless type.blank?
41
36
  end
42
37
  end
43
38
 
@@ -52,6 +47,10 @@ module ActionView
52
47
  def self.[](type)
53
48
  type_klass[type]
54
49
  end
50
+
51
+ def self.symbols
52
+ type_klass::SET.symbols
53
+ end
55
54
  end
56
55
  end
57
56
  end
@@ -28,7 +28,7 @@ module ActionView
28
28
  @response = ActionDispatch::TestResponse.new
29
29
 
30
30
  @request.env.delete('PATH_INFO')
31
- @params = {}
31
+ @params = ActionController::Parameters.new
32
32
  end
33
33
  end
34
34
 
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: 5.0.0.beta1.1
4
+ version: 5.0.0.beta2
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: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-02-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: 5.0.0.beta1.1
19
+ version: 5.0.0.beta2
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: 5.0.0.beta1.1
26
+ version: 5.0.0.beta2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -98,28 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 5.0.0.beta1.1
101
+ version: 5.0.0.beta2
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - '='
107
107
  - !ruby/object:Gem::Version
108
- version: 5.0.0.beta1.1
108
+ version: 5.0.0.beta2
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: activemodel
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - '='
114
114
  - !ruby/object:Gem::Version
115
- version: 5.0.0.beta1.1
115
+ version: 5.0.0.beta2
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - '='
121
121
  - !ruby/object:Gem::Version
122
- version: 5.0.0.beta1.1
122
+ version: 5.0.0.beta2
123
123
  description: Simple, battle-tested conventions and helpers for building web pages.
124
124
  email: david@loudthinking.com
125
125
  executables: []
@@ -219,6 +219,7 @@ files:
219
219
  - lib/action_view/template/handlers.rb
220
220
  - lib/action_view/template/handlers/builder.rb
221
221
  - lib/action_view/template/handlers/erb.rb
222
+ - lib/action_view/template/handlers/html.rb
222
223
  - lib/action_view/template/handlers/raw.rb
223
224
  - lib/action_view/template/html.rb
224
225
  - lib/action_view/template/resolver.rb
@@ -249,8 +250,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
250
  requirements:
250
251
  - none
251
252
  rubyforge_project:
252
- rubygems_version: 2.5.1
253
+ rubygems_version: 2.5.2
253
254
  signing_key:
254
255
  specification_version: 4
255
256
  summary: Rendering framework putting the V in MVC (part of Rails).
256
257
  test_files: []
258
+ has_rdoc: