summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-04 02:00:19 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-04 02:00:19 +0000
commit140560e4eeff4ffbf9d63183db25234f46943ab6 (patch)
treeb7f3e95078e32396249d6225899446e5bca1bda7 /lib
parent0efb15cda298c9e520376f46e8dcb59fb0cbaeaf (diff)
move definition of String#unicode_normalized? to C to make sure it is documented
* lib/unicode_normalize.rb: Remove definition of String#unicode_normalized? (including documentation). Leave a comment explaining that the file is now empty. * string.c: Define String#unicode_normalized? in rb_str_unicode_normalized_p in C, (including documentation) * lib/unicode_normalize/normalize.rb: Remove (re)definition of String#unicode_normalized? to avoid warnings (when $VERBOSE==true) and problems when String is frozen git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/unicode_normalize.rb25
-rw-r--r--lib/unicode_normalize/normalize.rb6
2 files changed, 2 insertions, 29 deletions
diff --git a/lib/unicode_normalize.rb b/lib/unicode_normalize.rb
index ef3f2ba6f1..b518197706 100644
--- a/lib/unicode_normalize.rb
+++ b/lib/unicode_normalize.rb
@@ -6,27 +6,6 @@
#--
# additions to class String for Unicode normalization
#++
-class String
- # :call-seq:
- # str.unicode_normalized?(form=:nfc)
- #
- # Checks whether +str+ is in Unicode normalization form +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.
- # For details, see String#unicode_normalize.
- #
- # "a\u0300".unicode_normalized? #=> false
- # "a\u0300".unicode_normalized?(:nfd) #=> true
- # "\u00E0".unicode_normalized? #=> true
- # "\u00E0".unicode_normalized?(:nfd) #=> false
- # "\xE0".force_encoding('ISO-8859-1').unicode_normalized?
- # #=> Encoding::CompatibilityError raised
- #
- def unicode_normalized?(form = :nfc)
- require 'unicode_normalize/normalize.rb'
- unicode_normalized? form
- end
-end
+###### This file is empty after it's contents has been converted to C
+###### and moved to string.c. This file will be removed soon.
diff --git a/lib/unicode_normalize/normalize.rb b/lib/unicode_normalize/normalize.rb
index 4302c6a975..90579a3212 100644
--- a/lib/unicode_normalize/normalize.rb
+++ b/lib/unicode_normalize/normalize.rb
@@ -158,9 +158,3 @@ module UnicodeNormalize # :nodoc:
end
end
end # module
-
-class String # :nodoc:
- def unicode_normalized?(form = :nfc)
- UnicodeNormalize.normalized?(self, form)
- end
-end