aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxed.co>2016-11-14 12:14:23 +0000
committerAndrew White <andrew.white@unboxed.co>2016-11-14 12:14:23 +0000
commit0189f4db6fe518de8909b66b7f30046bac52dedc (patch)
tree5d831ec2799bd0f87bc9ffa42c98a113dc423738 /activesupport
parent90520d2eee9093f46757a5e2e589d2237cc960f1 (diff)
downloadrails-0189f4db6fe518de8909b66b7f30046bac52dedc.tar.gz
rails-0189f4db6fe518de8909b66b7f30046bac52dedc.tar.bz2
rails-0189f4db6fe518de8909b66b7f30046bac52dedc.zip
Remove deprecated separator argument from parameterize
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md4
-rw-r--r--activesupport/lib/active_support/core_ext/string/inflections.rb6
-rw-r--r--activesupport/lib/active_support/inflector/transliterate.rb6
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb16
-rw-r--r--activesupport/test/inflector_test.rb18
5 files changed, 6 insertions, 44 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 7c7d6efa58..0a51eaf565 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Remove deprecated separator argument from `parameterize`
+
+ *Andrew White*
+
* Remove deprecated method `Numeric#to_formatted_s`
*Andrew White*
diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb
index 765c0919bb..4eabce79e2 100644
--- a/activesupport/lib/active_support/core_ext/string/inflections.rb
+++ b/activesupport/lib/active_support/core_ext/string/inflections.rb
@@ -178,11 +178,7 @@ class String
#
# <%= link_to(@person.name, person_path) %>
# # => <a href="/person/1-Donald-E-Knuth">Donald E. Knuth</a>
- def parameterize(sep = :unused, separator: "-", preserve_case: false)
- unless sep == :unused
- ActiveSupport::Deprecation.warn("Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: '#{sep}'` instead.")
- separator = sep
- end
+ def parameterize(separator: "-", preserve_case: false)
ActiveSupport::Inflector.parameterize(self, separator: separator, preserve_case: preserve_case)
end
diff --git a/activesupport/lib/active_support/inflector/transliterate.rb b/activesupport/lib/active_support/inflector/transliterate.rb
index 85fa83c803..3e78986e8e 100644
--- a/activesupport/lib/active_support/inflector/transliterate.rb
+++ b/activesupport/lib/active_support/inflector/transliterate.rb
@@ -78,11 +78,7 @@ module ActiveSupport
# parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
# parameterize("^trés|Jolie-- ", preserve_case: true) # => "tres-Jolie"
#
- def parameterize(string, sep = :unused, separator: "-", preserve_case: false)
- unless sep == :unused
- ActiveSupport::Deprecation.warn("Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: '#{sep}'` instead.")
- separator = sep
- end
+ def parameterize(string, separator: "-", preserve_case: false)
# Replace accented chars with their ASCII equivalents.
parameterized_string = transliterate(string)
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 4b40503d22..98bcdda45b 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -168,14 +168,6 @@ class StringInflectionsTest < ActiveSupport::TestCase
end
end
- def test_string_parameterized_no_separator_deprecated
- StringToParameterizeWithNoSeparator.each do |normal, slugged|
- assert_deprecated(/Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: ''` instead./i) do
- assert_equal(normal.parameterize(""), slugged)
- end
- end
- end
-
def test_string_parameterized_no_separator_preserve_case
StringToParameterizePreserveCaseWithNoSeparator.each do |normal, slugged|
assert_equal(normal.parameterize(separator: "", preserve_case: true), slugged)
@@ -188,14 +180,6 @@ class StringInflectionsTest < ActiveSupport::TestCase
end
end
- def test_string_parameterized_underscore_deprecated
- StringToParameterizeWithUnderscore.each do |normal, slugged|
- assert_deprecated(/Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: '_'` instead./i) do
- assert_equal(normal.parameterize("_"), slugged)
- end
- end
- end
-
def test_string_parameterized_underscore_preserve_case
StringToParameterizePreserceCaseWithUnderscore.each do |normal, slugged|
assert_equal(normal.parameterize(separator: "_", preserve_case: true), slugged)
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb
index 1c5a4f378c..d881bd346d 100644
--- a/activesupport/test/inflector_test.rb
+++ b/activesupport/test/inflector_test.rb
@@ -272,15 +272,6 @@ class InflectorTest < ActiveSupport::TestCase
end
end
- def test_parameterize_with_custom_separator_deprecated
- jruby_skip "UTF-8 to UTF8-MAC Converter is unavailable"
- StringToParameterizeWithUnderscore.each do |some_string, parameterized_string|
- assert_deprecated(/Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: '_'` instead./i) do
- assert_equal(parameterized_string, ActiveSupport::Inflector.parameterize(some_string, "_"))
- end
- end
- end
-
def test_parameterize_with_multi_character_separator
jruby_skip "UTF-8 to UTF8-MAC Converter is unavailable"
StringToParameterized.each do |some_string, parameterized_string|
@@ -288,15 +279,6 @@ class InflectorTest < ActiveSupport::TestCase
end
end
- def test_parameterize_with_multi_character_separator_deprecated
- jruby_skip "UTF-8 to UTF8-MAC Converter is unavailable"
- StringToParameterized.each do |some_string, parameterized_string|
- assert_deprecated(/Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: '__sep__'` instead./i) do
- assert_equal(parameterized_string.gsub("-", "__sep__"), ActiveSupport::Inflector.parameterize(some_string, "__sep__"))
- end
- end
- end
-
def test_classify
ClassNameToTableName.each do |class_name, table_name|
assert_equal(class_name, ActiveSupport::Inflector.classify(table_name))