diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-20 10:06:11 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-20 10:06:11 +0000 |
commit | acaafe2101be7bad03197075c7e1626640929c11 (patch) | |
tree | 352587fa87a01db6778923a6b50dc15d80f242a8 | |
parent | 3136025cd14f6750f5e6781612771140452ea0ed (diff) | |
download | ruby-acaafe2101be7bad03197075c7e1626640929c11.tar.gz |
lib/unicode_normalize.rb: revert r48046. The s in sIndex
is not hungarian notation. The variable name sIndex is
directly taken from the relevant part of the Unicode
Standard, where it is written SIndex and stands for
'syllable index'. See pp. 144/145 of
http://www.unicode.org/versions/Unicode7.0.0/ch03.pdf.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | lib/unicode_normalize/normalize.rb | 10 |
2 files changed, 14 insertions, 5 deletions
@@ -1,3 +1,12 @@ +Mon Oct 20 19:06:06 2014 Martin Duerst <duerst@it.aoyama.ac.jp> + + * lib/unicode_normalize.rb: revert r48046. The s in sIndex + is not hungarian notation. The variable name sIndex is + directly taken from the relevant part of the Unicode + Standard, where it is written SIndex and stands for + 'syllable index'. See pp. 144/145 of + http://www.unicode.org/versions/Unicode7.0.0/ch03.pdf. + Mon Oct 20 12:46:46 2014 Martin Duerst <duerst@it.aoyama.ac.jp> * lib/unicode_normalize.rb: removing unnecessary 'self'. diff --git a/lib/unicode_normalize/normalize.rb b/lib/unicode_normalize/normalize.rb index fa18407a6c..8bc8c6f607 100644 --- a/lib/unicode_normalize/normalize.rb +++ b/lib/unicode_normalize/normalize.rb @@ -43,11 +43,11 @@ module UnicodeNormalize ## Hangul Algorithm def self.hangul_decomp_one(target) - index = target.ord - SBASE - return target if index < 0 || index >= SCOUNT - l = LBASE + index / NCOUNT - v = VBASE + (index % NCOUNT) / TCOUNT - t = TBASE + index % TCOUNT + sIndex = target.ord - SBASE + return target if sIndex < 0 || sIndex >= SCOUNT + l = LBASE + sIndex / NCOUNT + v = VBASE + (sIndex % NCOUNT) / TCOUNT + t = TBASE + sIndex % TCOUNT (t==TBASE ? [l, v] : [l, v, t]).pack('U*') + target[1..-1] end |