diff options
author | Francesco Rodríguez <frodsan@me.com> | 2018-10-18 21:51:21 +0200 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2018-10-18 14:10:30 -0700 |
commit | b0f3070209499474d139ad46336eda9c57c16e88 (patch) | |
tree | c339f2b74bccead55a222127dd1b1dc422cad937 /activesupport/lib/active_support | |
parent | 885ab065b50ee42f9054b853adeb8c2a8c445680 (diff) | |
download | rails-b0f3070209499474d139ad46336eda9c57c16e88.tar.gz rails-b0f3070209499474d139ad46336eda9c57c16e88.tar.bz2 rails-b0f3070209499474d139ad46336eda9c57c16e88.zip |
Deprecate Unicode's #pack_graphemes and #unpack_graphemes methods
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/multibyte/unicode.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/multibyte/unicode.rb b/activesupport/lib/active_support/multibyte/unicode.rb index 43d196eeeb..ce8ecece69 100644 --- a/activesupport/lib/active_support/multibyte/unicode.rb +++ b/activesupport/lib/active_support/multibyte/unicode.rb @@ -34,6 +34,11 @@ module ActiveSupport # Unicode.unpack_graphemes('क्षि') # => [[2325, 2381], [2359], [2367]] # Unicode.unpack_graphemes('Café') # => [[67], [97], [102], [233]] def unpack_graphemes(string) + ActiveSupport::Deprecation.warn(<<-MSG.squish) + ActiveSupport::Multibyte::Unicode#unpack_graphemes is deprecated and will be + removed from Rails 6.1. Use string.scan(/\X/).map(&:codepoints) instead. + MSG + string.scan(/\X/).map(&:codepoints) end @@ -41,6 +46,11 @@ module ActiveSupport # # Unicode.pack_graphemes(Unicode.unpack_graphemes('क्षि')) # => 'क्षि' def pack_graphemes(unpacked) + ActiveSupport::Deprecation.warn(<<-MSG.squish) + ActiveSupport::Multibyte::Unicode#pack_graphemes is deprecated and will be + removed from Rails 6.1. Use array.flatten.pack("U*") instead. + MSG + unpacked.flatten.pack("U*") end |