[Hiki-cvs 1439] [986] * hiki/docdiff/charstring.rb: code cleanup.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 8月 17日 (月) 10:11:34 JST


Revision: 986
          http://sourceforge.jp/projects/hiki/svn/view?view=rev&revision=986
Author:   fdiary
Date:     2009-08-17 10:11:34 +0900 (Mon, 17 Aug 2009)

Log Message:
-----------
	* hiki/docdiff/charstring.rb: code cleanup.

Modified Paths:
--------------
    hiki/trunk/ChangeLog
    hiki/trunk/hiki/config.rb
    hiki/trunk/hiki/docdiff/charstring.rb

Modified: hiki/trunk/ChangeLog
===================================================================
--- hiki/trunk/ChangeLog	2009-08-16 17:46:38 UTC (rev 985)
+++ hiki/trunk/ChangeLog	2009-08-17 01:11:34 UTC (rev 986)
@@ -1,3 +1,6 @@
+2009-08-17  Kazuhiko  <kazuh****@fdiar*****>
+	* hiki/docdiff/charstring.rb: code cleanup.
+
 2009-08-16  Kazuhiko  <kazuh****@fdiar*****>
 	* hiki/docdiff/charstring.rb: many changes for Ruby-1.9.
 	* hiki/docdiff/encoding/document.rb: do not guess encoding for

Modified: hiki/trunk/hiki/config.rb
===================================================================
--- hiki/trunk/hiki/config.rb	2009-08-16 17:46:38 UTC (rev 985)
+++ hiki/trunk/hiki/config.rb	2009-08-17 01:11:34 UTC (rev 986)
@@ -5,7 +5,7 @@
 
 module Hiki
   VERSION = '0.9dev'
-  RELEASE_DATE = '2009-08-16'
+  RELEASE_DATE = '2009-08-17'
 end
 
 # For backward compatibility

Modified: hiki/trunk/hiki/docdiff/charstring.rb
===================================================================
--- hiki/trunk/hiki/docdiff/charstring.rb	2009-08-16 17:46:38 UTC (rev 985)
+++ hiki/trunk/hiki/docdiff/charstring.rb	2009-08-17 01:11:34 UTC (rev 986)
@@ -144,100 +144,100 @@
 
   def split_to_char()
     if eol_char  # sometimes string has no end-of-line char
-      encode('UTF-8').scan(Regexp.new("(?:#{eol_char})|(?:.)", 
+      scan(Regexp.new("(?:#{eol_char})|(?:.)", 
                       Regexp::MULTILINE)
-      ).map{|e| e.encode(self.encoding)}
+      )
     else                  # it seems that no EOL module was extended...
-      encode('UTF-8').scan(Regexp.new("(?:.)", 
+      scan(Regexp.new("(?:.)", 
                       Regexp::MULTILINE)
-      ).map{|e| e.encode(self.encoding)}
+      )
     end
   end
 
   def count_latin_graph_char()
-    encode('UTF-8').scan(Regexp.new("[#{Encodings['UTF-8']::GRAPH}]", 
+    scan(Regexp.new("[#{Encodings['UTF-8']::GRAPH}]", 
                     Regexp::MULTILINE)
     ).size
   end
 
   def count_ja_graph_char()
-    encode('UTF-8').scan(Regexp.new("[#{Encodings['UTF-8']::JA_GRAPH}]", 
+    scan(Regexp.new("[#{Encodings['UTF-8']::JA_GRAPH}]".encode(encoding), 
                     Regexp::MULTILINE)
     ).size
   end
 
   def count_latin_blank_char()
-    encode('UTF-8').scan(Regexp.new("[#{Encodings['UTF-8']::BLANK}]", 
+    scan(Regexp.new("[#{Encodings['UTF-8']::BLANK}]", 
                     Regexp::MULTILINE)
     ).size
   end
 
   def count_ja_blank_char()
-    encode('UTF-8').scan(Regexp.new("[#{Encodings['UTF-8']::JA_BLANK}]", 
+    scan(Regexp.new("[#{Encodings['UTF-8']::JA_BLANK}]".encode(encoding), 
                     Regexp::MULTILINE)
     ).size
   end
 
   def split_to_word()
-    encode('UTF-8').scan(Regexp.new(Encodings['UTF-8']::WORD_REGEXP_SRC, 
+    scan(Regexp.new(Encodings['UTF-8']::WORD_REGEXP_SRC.encode(encoding), 
                     Regexp::MULTILINE)
-    ).map{|e| e.encode(self.encoding)}
+    )
   end
 
   def count_latin_word()
     split_to_word.collect{|word|
       word if Regexp.new("[#{Encodings['UTF-8']::PRINT}]", 
-                         Regexp::MULTILINE).match word.encode('UTF-8')
+                         Regexp::MULTILINE).match word
     }.compact.size
   end
 
   def count_ja_word()
     split_to_word.collect{|word|
-      word if Regexp.new("[#{Encodings['UTF-8']::JA_PRINT}]", 
-                         Regexp::MULTILINE).match word.encode('UTF-8')
+      word if Regexp.new("[#{Encodings['UTF-8']::JA_PRINT}]".encode(encoding), 
+                         Regexp::MULTILINE).match word
     }.compact.size
   end
 
   def count_latin_valid_word()
     split_to_word.collect{|word|
       word if Regexp.new("[#{Encodings['UTF-8']::ALNUM}]", 
-                         Regexp::MULTILINE).match word.encode('UTF-8')
+                         Regexp::MULTILINE).match word
     }.compact.size
   end
 
   def count_ja_valid_word()
     split_to_word.collect{|word|
-      word if Regexp.new("[#{Encodings['UTF-8']::JA_GRAPH}]", 
-                         Regexp::MULTILINE).match word.encode('UTF-8')
+      word if Regexp.new("[#{Encodings['UTF-8']::JA_GRAPH}]".encode(encoding), 
+                         Regexp::MULTILINE).match word
     }.compact.size
   end
 
   def split_to_line()
     raise "EOLChars[eol] is #{EOLChars[eol].inspect}: eol not specified or auto-detection failed." unless EOLChars[eol]
     if defined? eol_char
-      encode('UTF-8').scan(Regexp.new(".*?#{eol_char}|.+", 
+      scan(Regexp.new(".*?#{eol_char}|.+", 
                       Regexp::MULTILINE)
-      ).map{|e| e.encode(self.encoding)}
+      )
     else
-      encode('UTF-8').scan(Regexp.new(".+", 
+      scan(Regexp.new(".+", 
                       Regexp::MULTILINE)
-      ).map{|e| e.encode(self.encoding)}
+      )
     end
   end
 
   def count_graph_line()
     split_to_line.collect{|line|
       line if Regexp.new("[#{Encodings['UTF-8']::GRAPH}" + 
-                         "#{Encodings['UTF-8']::JA_GRAPH}]", 
-                         Regexp::MULTILINE).match line.encode('UTF-8')
+                         "#{Encodings['UTF-8']::JA_GRAPH}]".encode(encoding), 
+                         Regexp::MULTILINE).match line
     }.compact.size
   end
 
   def count_blank_line()
     split_to_line.collect{|line|
       line if Regexp.new("^[#{Encodings['UTF-8']::BLANK}" + 
-                         "#{Encodings['UTF-8']::JA_BLANK}]+(?:#{eol_char})?", 
-                         Regexp::MULTILINE).match line.encode('UTF-8')
+                         "#{Encodings['UTF-8']::JA_BLANK}]+(?:#{eol_char})?".encode(encoding), 
+                         Regexp::MULTILINE).match line
     }.compact.size
   end
 




Hiki-cvs メーリングリストの案内
Back to archive index