update.
[chise/ruby.git] / ext / sample.rb
index 9702556..dd5bf40 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env ruby
 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
 
-require "libchise_c"
+require "libchise"
 $LOAD_PATH.unshift("..")
 require "chise/qp"
 
@@ -12,7 +12,7 @@ def die(msg)
 end
 
 def main
-  db_dir = CHISE::DB_DIR
+  db_dir = CHISE::DataSource::DB_DIR
   @ds = CHISE::DataSource.new(CHISE::DataSource::Berkeley_DB, db_dir, 0, 0755)
   die "Can't open data source" if @ds.nil?
 
@@ -28,10 +28,10 @@ def main
 
   ft = @ds.get_feature("ideographic-structure")
   value = ft.get_value(char_id)
-  printf("#x%X => %s\n", char_id, value.to_s)
+  printf("#x%X => %s\n", char_id, value)
 
   @ds.each_feature_name {|name|
-    #puts "rb_feature : "+name
+    puts "feature : "+name
   }
 
   ft = @ds.get_feature("numeric-value")
@@ -40,18 +40,18 @@ def main
 
     ucs = @ds.get_feature("=ucs").get_value(cid)
     if ucs
-      printf("[U-%08X]", ucs.to_s.to_i)
+      printf("[U-%08X]", ucs.to_i)
     else
       ucs = @ds.get_feature("=>ucs").get_value(cid)
       if ucs
-       printf("(U-%08X)", ucs.to_s.to_i)
+       printf("(U-%08X)", ucs.to_i)
       else
        printf("            ")
       end
     end
 
     printf(" %s", @ds.get_feature("name").get_value(cid))
-    printf(" %s\n", valdatum.to_s)
+    printf(" %s\n", valdatum)
   }
 
   @ds.close