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

ruby-changes:35960

From: nobu <ko1@a...>
Date: Mon, 20 Oct 2014 12:42:57 +0900 (JST)
Subject: [ruby-changes:35960] nobu:r48041 (trunk): tool/unicode_norm_gen.rb: for 1.8.5 BASERUBY

nobu	2014-10-20 12:42:42 +0900 (Mon, 20 Oct 2014)

  New Revision: 48041

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

  Log:
    tool/unicode_norm_gen.rb: for 1.8.5 BASERUBY
    
    * tool/unicode_norm_gen.rb: get rid of new features for 1.8.5
      BASERUBY.

  Modified files:
    trunk/tool/unicode_norm_gen.rb
Index: tool/unicode_norm_gen.rb
===================================================================
--- tool/unicode_norm_gen.rb	(revision 48040)
+++ tool/unicode_norm_gen.rb	(revision 48041)
@@ -24,10 +24,14 @@ end https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L24
 
 class Array
   def line_slice(new_line) # joins items, 8 items per line
-    each_slice(8).collect(&:join).join(new_line).gsub(/ +$/, '')
+    ary = []
+    0.step(size-1, 8) {|i|
+      ary << self[i, 8].join('')
+    }
+    ary.join(new_line).gsub(/ +$/, '')
   end
 
-  def to_UTF8()  collect(&:to_UTF8).join  end
+  def to_UTF8() collect {|c| c.to_UTF8}.join('') end
 
   def to_regexp_chars # converts an array of Integers to character ranges
     sort.inject([]) do |ranges, value|
@@ -59,8 +63,9 @@ class Hash https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L63
 end
 
 # read the file 'CompositionExclusions.txt'
-composition_exclusions = IO.readlines("#{InputDataDir}/CompositionExclusions.txt").
-                            grep(/^[A-Z0-9]{4,5}/) {|line| line.split(' ').first.hex}
+composition_exclusions = File.open("#{InputDataDir}/CompositionExclusions.txt") {|f|
+  f.grep(/^[A-Z0-9]{4,5}/) {|line| line.hex}
+}
 
 decomposition_table = {}
 kompatible_table = {}
@@ -72,9 +77,9 @@ IO.foreach("#{InputDataDir}/UnicodeData. https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L77
 
   case decomposition
   when /^[0-9A-F]/
-    decomposition_table[codepoint.hex] = decomposition.split(' ').collect(&:hex)
+    decomposition_table[codepoint.hex] = decomposition.split(' ').collect {|w| w.hex}
   when /^</
-    kompatible_table[codepoint.hex] = decomposition.split(' ').drop(1).collect(&:hex)
+    kompatible_table[codepoint.hex] = decomposition.split(' ')[1..-1].collect {|w| w.hex}
   end
   CombiningClass[codepoint.hex] = char_class.to_i if char_class != "0"
 
@@ -94,11 +99,12 @@ end.invert https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L99
 # recalculate composition_exclusions
 composition_exclusions = decomposition_table.keys - composition_table.values
 
-accent_array = CombiningClass.keys + composition_table.keys.collect(&:last)
+accent_array = CombiningClass.keys + composition_table.keys.collect {|key| key.last}
 
-composition_starters = composition_table.keys.collect(&:first)
+composition_starters = composition_table.keys.collect {|key| key.first}
 
-hangul_no_trailing = 0xAC00.step(0xD7A3, 28).to_a
+hangul_no_trailing = []
+0xAC00.step(0xD7A3, 28) {|c| hangul_no_trailing << c}
 
 # expand decomposition table values
 decomposition_table.each do |key, value|

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

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