update.
[chise/ruby.git] / chise / character.rb
index c133c53..76039bb 100755 (executable)
@@ -36,7 +36,8 @@ module CHISE
 
   class Character
     include UTF8Value
-    include IDS_Module
+    include CharacterIDC
+    include CharacterIDS
 
     def initialize(char_id)
       raise if char_id.nil?
@@ -48,7 +49,7 @@ module CHISE
       @utf8_mcs = itou8(@char_id)
       @utf8_mcs.freeze
       @feature = {}
-      @check_all_done = nil
+      # @check_all_done = nil
     end
     attr_reader :char_id
     attr_reader :utf8_mcs
@@ -112,14 +113,26 @@ module CHISE
       en.to_er(self)
     end
 
-    def is_idc?
-      0x2ff0 <= @char_id && @char_id <= 0x2fff
+    def each_feature
+      cd = ChiseDB.instance
+      cd.each_feature {|f|
+       ft = cd.get_feature(f)
+       begin
+         v = ft.get_value(@char_id)
+         next if v.nil?
+         yield(f, v)
+       ensure
+         ft.close
+       end
+      }
     end
 
-    def idc_argument_number
-      return 0 unless is_idc?
-      return 3 if @char_id == 0x2ff2 || @char_id == 0x2ff3
-      return 2
+    def hash_feature
+      h = {}
+      each_feature {|k, v|
+       h[k] = v
+      }
+      h
     end
 
     private
@@ -138,5 +151,6 @@ module CHISE
       a = a.sub(/\Afrom-/, "<-")
       a
     end
+
   end
 end