mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
3a2f81cf9a
commit
7f652dc6cf
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue