ruby-changes:35733
From: nobu <ko1@a...>
Date: Mon, 6 Oct 2014 12:08:48 +0900 (JST)
Subject: [ruby-changes:35733] nobu:r47815 (trunk): unicode_norm_gen.rb: freeze
nobu 2014-10-06 12:08:25 +0900 (Mon, 06 Oct 2014) New Revision: 47815 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47815 Log: unicode_norm_gen.rb: freeze * tool/unicode_norm_gen.rb: freeze strings and tables. Modified files: trunk/tool/unicode_norm_gen.rb Index: tool/unicode_norm_gen.rb =================================================================== --- tool/unicode_norm_gen.rb (revision 47814) +++ tool/unicode_norm_gen.rb (revision 47815) @@ -23,8 +23,8 @@ class Integer https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L23 end class Array - def line_slice (new_line) # joins items, 16 items per line - each_slice(16).collect(&:join).join new_line + def line_slice(new_line) # joins items, 8 items per line + each_slice(8).collect(&:join).join(new_line).gsub(/ +$/, '') end def to_UTF8() collect(&:to_UTF8).join end @@ -53,7 +53,7 @@ end https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L53 class Hash def to_hash_string collect do |key, value| - "\"#{key.to_UTF8}\"=>\"#{value.to_UTF8}\", " + "\"#{key.to_UTF8}\"=>\"#{value.to_UTF8}\".freeze, " end.line_slice "\n " end end @@ -143,7 +143,7 @@ open("#{OuputDataDir}/normalize_tables.r https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L143 module Normalize accents = "" \\ "[#{accent_array.to_regexp_chars}]" \\ - "" + "".freeze ACCENTS = accents REGEXP_D_STRING = "\#{'' # composition starters and composition exclusions }" \\ @@ -154,7 +154,7 @@ module Normalize https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L154 "|\#{'' # precomposed Hangul syllables }" \\ "[\\u{AC00}-\\u{D7A4}]" \\ - "" + "".freeze REGEXP_C_STRING = "\#{'' # composition exclusions }" \\ "[#{composition_exclusions.to_regexp_chars}]\#{accents}*" \\ @@ -167,27 +167,27 @@ module Normalize https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L167 "|\#{'' # decomposed Hangul syllables }" \\ "[\\u1100-\\u1112][\\u1161-\\u1175][\\u11A8-\\u11C2]?" \\ - "" + "".freeze REGEXP_K_STRING = "" \\ "[#{kompatible_table.keys.to_regexp_chars}]" \\ - "" + "".freeze class_table = { #{class_table_str} } class_table.default = 0 - CLASS_TABLE = class_table + CLASS_TABLE = class_table.freeze DECOMPOSITION_TABLE = { #{decomposition_table.to_hash_string} - } + }.freeze KOMPATIBLE_TABLE = { #{kompatible_table.to_hash_string} - } + }.freeze COMPOSITION_TABLE = { #{composition_table.to_hash_string} - } + }.freeze end MAPPING_TABLE_FILE_END -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/