PATH:
opt
/
alt
/
ruby23
/
lib64
/
ruby
/
2.3.0
# coding: utf-8 # frozen_string_literal: false # Copyright Ayumu Nojima (野島 歩) and Martin J. Dürst (duerst@it.aoyama.ac.jp) # additions to class String for Unicode normalization class String # === Unicode Normalization # # :call-seq: # str.unicode_normalize(form=:nfc) # # Returns a normalized form of +str+, using Unicode normalizations # NFC, NFD, NFKC, or NFKD. The normalization form used is determined # by +form+, which is 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 # else than UTF-8 is implemented by converting to UTF-8, # which makes it slower than UTF-8. # # _Examples_ # # "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' unless defined? UnicodeNormalize ## The following line can be uncommented to avoid repeated checking for ## UnicodeNormalize. However, tests didn't show any noticeable speedup ## when doing this. This comment also applies to the commented out lines ## in String#unicode_normalize! and String#unicode_normalized?. # String.send(:define_method, :unicode_normalize, ->(form = :nfc) { UnicodeNormalize.normalize(self, form) } ) UnicodeNormalize.normalize(self, form) end # :call-seq: # str.unicode_normalize!(form=:nfc) # # Destructive version of String#unicode_normalize, doing Unicode # normalization in place. # def unicode_normalize!(form = :nfc) require 'unicode_normalize/normalize.rb' unless defined? UnicodeNormalize # String.send(:define_method, :unicode_normalize!, ->(form = :nfc) { replace(unicode_normalize(form)) } ) replace(unicode_normalize(form)) end # :call-seq: # str.unicode_normalized?(form=:nfc) # # Checks whether +str+ is in Unicode normalization form +form+, # which is 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. # # _Examples_ # # "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' unless defined? UnicodeNormalize # String.send(:define_method, :unicode_normalized?, ->(form = :nfc) { UnicodeNormalize.normalized?(self, form) } ) UnicodeNormalize.normalized?(self, form) end end
[+]
rinda
[+]
yaml
[-] matrix.rb
[edit]
[+]
rdoc
[-] shell.rb
[edit]
[-] ostruct.rb
[edit]
[-] scanf.rb
[edit]
[+]
ripper
[-] rdoc.rb
[edit]
[-] getoptlong.rb
[edit]
[-] sync.rb
[edit]
[-] delegate.rb
[edit]
[-] psych_jars.rb
[edit]
[-] open-uri.rb
[edit]
[-] json.rb
[edit]
[-] rubygems.rb
[edit]
[-] openssl.rb
[edit]
[+]
json
[-] debug.rb
[edit]
[+]
irb
[-] digest.rb
[edit]
[-] yaml.rb
[edit]
[-] forwardable.rb
[edit]
[-] weakref.rb
[edit]
[-] benchmark.rb
[edit]
[-] profiler.rb
[edit]
[-] uri.rb
[edit]
[-] English.rb
[edit]
[+]
syslog
[-] xmlrpc.rb
[edit]
[-] timeout.rb
[edit]
[+]
rbconfig
[-] tracer.rb
[edit]
[-] resolv.rb
[edit]
[+]
uri
[-] tsort.rb
[edit]
[-] find.rb
[edit]
[-] logger.rb
[edit]
[-] psych.rb
[edit]
[+]
psych
[-] ubygems.rb
[edit]
[-] profile.rb
[edit]
[-] optparse.rb
[edit]
[+]
matrix
[-] pp.rb
[edit]
[-] date.rb
[edit]
[-] cmath.rb
[edit]
[-] ripper.rb
[edit]
[-] fiddle.rb
[edit]
[+]
drb
[+]
io
[+]
webrick
[+]
unicode_normalize
[-] cgi.rb
[edit]
[-] pathname.rb
[edit]
[+]
xmlrpc
[-] mutex_m.rb
[edit]
[-] unicode_normalize.rb
[edit]
[+]
rss
[+]
racc
[+]
..
[-] prettyprint.rb
[edit]
[-] csv.rb
[edit]
[-] kconv.rb
[edit]
[-] securerandom.rb
[edit]
[+]
fiddle
[-] abbrev.rb
[edit]
[-] resolv-replace.rb
[edit]
[+]
digest
[-] mathn.rb
[edit]
[+]
rexml
[-] optionparser.rb
[edit]
[-] e2mmap.rb
[edit]
[-] shellwords.rb
[edit]
[-] rss.rb
[edit]
[-] time.rb
[edit]
[+]
openssl
[-] fileutils.rb
[edit]
[-] socket.rb
[edit]
[+]
net
[-] monitor.rb
[edit]
[-] tempfile.rb
[edit]
[-] un.rb
[edit]
[-] mkmf.rb
[edit]
[-] base64.rb
[edit]
[-] thwait.rb
[edit]
[-] webrick.rb
[edit]
[-] erb.rb
[edit]
[+]
shell
[-] expect.rb
[edit]
[-] open3.rb
[edit]
[+]
cgi
[-] tmpdir.rb
[edit]
[-] ipaddr.rb
[edit]
[-] pstore.rb
[edit]
[-] singleton.rb
[edit]
[+]
rubygems
[-] set.rb
[edit]
[-] observer.rb
[edit]
[-] drb.rb
[edit]
[-] irb.rb
[edit]
[-] prime.rb
[edit]
[+]
x86_64-linux
[+]
optparse