ruby-changes:35974
From: nobu <ko1@a...>
Date: Mon, 20 Oct 2014 20:50:14 +0900 (JST)
Subject: [ruby-changes:35974] nobu:r48055 (trunk): unicode_normalize/normalize.rb: rename variable
nobu 2014-10-20 20:50:00 +0900 (Mon, 20 Oct 2014) New Revision: 48055 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48055 Log: unicode_normalize/normalize.rb: rename variable * lib/unicode_normalize/normalize.rb (hangul_decomp_one): use more descriptive name. leave [SLVT]BASE and [LVTNS]COUNT as they are vague names. Modified files: trunk/lib/unicode_normalize/normalize.rb Index: lib/unicode_normalize/normalize.rb =================================================================== --- lib/unicode_normalize/normalize.rb (revision 48054) +++ lib/unicode_normalize/normalize.rb (revision 48055) @@ -43,11 +43,11 @@ module UnicodeNormalize https://github.com/ruby/ruby/blob/trunk/lib/unicode_normalize/normalize.rb#L43 ## Hangul Algorithm def self.hangul_decomp_one(target) - sIndex = target.ord - SBASE - return target if sIndex < 0 || sIndex >= SCOUNT - l = LBASE + sIndex / NCOUNT - v = VBASE + (sIndex % NCOUNT) / TCOUNT - t = TBASE + sIndex % TCOUNT + syllable_index = target.ord - SBASE + return target if syllable_index < 0 || syllable_index >= SCOUNT + l = LBASE + syllable_index / NCOUNT + v = VBASE + (syllable_index % NCOUNT) / TCOUNT + t = TBASE + syllable_index % TCOUNT (t==TBASE ? [l, v] : [l, v, t]).pack('U*') + target[1..-1] end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/