update.
[chise/ruby.git] / chise / string.rb
index 929c7ca..7569db0 100755 (executable)
@@ -2,8 +2,11 @@
 
 require "chise/character"
 require "chise/parser"
+require "chise/ids"
 
 class String
+  include CHISE::StringIDS
+
   # copied from htree/encoder.rb
   UTF8_RE = /\A(?:
         [\x00-\x7f]
@@ -22,8 +25,9 @@ class String
     CHISE::Character.get("?"+self)
   end
 
-  def method_missing(mid, *args)
-    char.method_missing(mid, *args)
+  def method_missing(mid, *args, &block)
+    #char.method_missing(mid, *args)
+    char.send(mid, *args, &block)
   end
 
   def to_a
@@ -40,6 +44,12 @@ class String
     }
   end
 
+  def map_char
+    to_a.map {|c|
+      yield(c).to_s
+    }.join
+  end
+
   def each_character
     to_a.each {|ch|
       yield ch.char
@@ -51,4 +61,8 @@ class String
     pa.de_er(self)
   end
 
+  def to_ids
+    CHISE::IDS.new(self)
+  end
+
 end