[前][次][番号順一覧][スレッド一覧]

ruby-changes:35964

From: nobu <ko1@a...>
Date: Mon, 20 Oct 2014 14:01:10 +0900 (JST)
Subject: [ruby-changes:35964] nobu:r48045 (trunk): unicode_normalize/normalize.rb: simplify

nobu	2014-10-20 14:00:58 +0900 (Mon, 20 Oct 2014)

  New Revision: 48045

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48045

  Log:
    unicode_normalize/normalize.rb: simplify
    
    * lib/unicode_normalize/normalize.rb (NF_HASH_{D,C,K}): remove
      first element by Hash#shift.

  Modified files:
    trunk/lib/unicode_normalize/normalize.rb
Index: lib/unicode_normalize/normalize.rb
===================================================================
--- lib/unicode_normalize/normalize.rb	(revision 48044)
+++ lib/unicode_normalize/normalize.rb	(revision 48045)
@@ -14,15 +14,15 @@ module UnicodeNormalize https://github.com/ruby/ruby/blob/trunk/lib/unicode_normalize/normalize.rb#L14
   REGEXP_C = Regexp.compile(REGEXP_C_STRING, Regexp::EXTENDED)
   REGEXP_K = Regexp.compile(REGEXP_K_STRING, Regexp::EXTENDED)
   NF_HASH_D = Hash.new do |hash, key|
-                         hash.delete hash.first[0] if hash.length>MAX_HASH_LENGTH # prevent DoS attack
+                         hash.shift if hash.length>MAX_HASH_LENGTH # prevent DoS attack
                          hash[key] = nfd_one(key)
                        end
   NF_HASH_C = Hash.new do |hash, key|
-                         hash.delete hash.first[0] if hash.length>MAX_HASH_LENGTH # prevent DoS attack
+                         hash.shift if hash.length>MAX_HASH_LENGTH # prevent DoS attack
                          hash[key] = nfc_one(key)
                        end
   NF_HASH_K = Hash.new do |hash, key|
-                         hash.delete hash.first[0] if hash.length>MAX_HASH_LENGTH # prevent DoS attack
+                         hash.shift if hash.length>MAX_HASH_LENGTH # prevent DoS attack
                          hash[key] = nfkd_one(key)
                        end
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]