summaryrefslogtreecommitdiff
path: root/lib/unicode_normalize
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-20 05:00:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-20 05:00:58 +0000
commit7f652dc6cf444d8d342f6a019faf3b54fa16be67 (patch)
tree90a9c7a4ac6a7449f9db99ebf62bbe14d9ece245 /lib/unicode_normalize
parent3a2f81cf9a9324957f06997447783a3c7a9177e9 (diff)
unicode_normalize/normalize.rb: simplify
* lib/unicode_normalize/normalize.rb (NF_HASH_{D,C,K}): remove first element by Hash#shift. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/unicode_normalize')
-rw-r--r--lib/unicode_normalize/normalize.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/unicode_normalize/normalize.rb b/lib/unicode_normalize/normalize.rb
index 22768f4..8bc8c6f 100644
--- a/lib/unicode_normalize/normalize.rb
+++ b/lib/unicode_normalize/normalize.rb
@@ -14,15 +14,15 @@ module UnicodeNormalize
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