Skip to content

Commit aaa111f

Browse files
authored
Merge pull request rails#54081 from byroot/deprecate-mb-chars
Deprecate `String#mb_chars` and `AS::Multibyte::Chars`.
2 parents eb6183f + ebbbc48 commit aaa111f

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

activesupport/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
* Deprecate `String#mb_chars` and `ActiveSupport::Multibyte::Chars`.
2+
3+
These APIs are a relic of the Ruby 1.8 days when Ruby strings weren't encoding
4+
aware. There is no legitimate reasons to need these APIs today.
5+
6+
*Jean Boussier*
7+
18
* Deprecate `ActiveSupport::Configurable`
29

310
*Sean Doyle*

activesupport/lib/active_support/multibyte.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ module Multibyte
1212
#
1313
# ActiveSupport::Multibyte.proxy_class = CharsForUTF32
1414
def self.proxy_class=(klass)
15+
ActiveSupport.deprecator.warn(
16+
"ActiveSupport::Multibyte.proxy_class= is deprecated and will be removed in Rails 8.2. " \
17+
"Use normal string methods instead."
18+
)
1519
@proxy_class = klass
1620
end
1721

activesupport/lib/active_support/multibyte/chars.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
require "active_support/core_ext/string/behavior"
66
require "active_support/core_ext/module/delegation"
77

8+
ActiveSupport.deprecator.warn(
9+
"ActiveSupport::Multibyte::Chars and String#mb_chars are deprecated and will be removed in Rails 8.2. " \
10+
"Use normal string methods instead."
11+
)
12+
813
module ActiveSupport # :nodoc:
914
module Multibyte # :nodoc:
1015
# = Active Support \Multibyte \Chars

activesupport/test/abstract_unit.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
# Disable available locale checks to avoid warnings running the test suite.
3535
I18n.enforce_available_locales = false
3636

37+
ActiveSupport.deprecator.silence do
38+
ActiveSupport::Multibyte.const_get(:Chars)
39+
end
40+
3741
class ActiveSupport::TestCase
3842
if Process.respond_to?(:fork) && !Gem.win_platform?
3943
parallelize

0 commit comments

Comments
 (0)