From 336b50e5a91bf2542605143cc266421121a10547 Mon Sep 17 00:00:00 2001 From: duerst Date: Wed, 3 May 2017 12:18:37 +0000 Subject: move definition of String#unicode_normalize to C to make sure it is documented * lib/unicode_normalize.rb: Remove definition of String#unicode_normalize (including documentation) * string.c: Define String#unicode_normalize in rb_str_unicode_normalize in C, (including documentation) * lib/unicode_normalize/normalize.rb: Remove (re)definition of String#unicode_normalize to avoid warnings (when $VERBOSE==true) and problems when String is frozen git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/unicode_normalize.rb | 26 -------------------------- lib/unicode_normalize/normalize.rb | 4 ---- 2 files changed, 30 deletions(-) (limited to 'lib') diff --git a/lib/unicode_normalize.rb b/lib/unicode_normalize.rb index 0630b8627e..3f359a0ff3 100644 --- a/lib/unicode_normalize.rb +++ b/lib/unicode_normalize.rb @@ -8,32 +8,6 @@ #++ class String - # :call-seq: - # str.unicode_normalize(form=:nfc) - # - # Unicode Normalization---Returns a normalized form of +str+, - # using Unicode normalizations NFC, NFD, NFKC, or NFKD. - # The normalization form used is determined by +form+, which can - # be any of the four values +:nfc+, +:nfd+, +:nfkc+, or +:nfkd+. - # The default is +:nfc+. - # - # If the string is not in a Unicode Encoding, then an Exception is raised. - # In this context, 'Unicode Encoding' means any of UTF-8, UTF-16BE/LE, - # and UTF-32BE/LE, as well as GB18030, UCS_2BE, and UCS_4BE. - # Anything other than UTF-8 is implemented by converting to UTF-8, - # which makes it slower than UTF-8. - # - # "a\u0300".unicode_normalize #=> 'à' (same as "\u00E0") - # "a\u0300".unicode_normalize(:nfc) #=> 'à' (same as "\u00E0") - # "\u00E0".unicode_normalize(:nfd) #=> 'à' (same as "a\u0300") - # "\xE0".force_encoding('ISO-8859-1').unicode_normalize(:nfd) - # #=> Encoding::CompatibilityError raised - # - def unicode_normalize(form = :nfc) - require 'unicode_normalize/normalize.rb' - unicode_normalize form # no recursion, because redefined in unicode_normalize/normalize.rb - end - # :call-seq: # str.unicode_normalize!(form=:nfc) # diff --git a/lib/unicode_normalize/normalize.rb b/lib/unicode_normalize/normalize.rb index 87b84589a5..8bfbbfeea5 100644 --- a/lib/unicode_normalize/normalize.rb +++ b/lib/unicode_normalize/normalize.rb @@ -160,10 +160,6 @@ module UnicodeNormalize # :nodoc: end # module class String # :nodoc: - def unicode_normalize(form = :nfc) - UnicodeNormalize.normalize(self, form) - end - def unicode_normalize!(form = :nfc) replace(UnicodeNormalize.normalize(self, form)) end -- cgit v1.2.3