ROXML続報

 初期化がまだ足りない箇所があったので、その辺も修正。あと、とんでもないミスも。

--- roxml.rb        2006-09-25 01:12:47.000000000 +0900
+++ roxml.rb    2006-10-01 02:07:30.000000000 +0900
@@ -401,16 +401,25 @@
         def tag_refs
             @xml_refs || []
         end
-
+
+        #initialize flag
+        def setZero
+            @@tag_flag = false
+            @@xml_ref_flag = false
+        end
+        module_function :setZero
+
         private

         def add_ref(xml_ref)
-            @xml_refs = [] unless @xml_refs
+            @xml_refs = [] unless @xml_refs && @@xml_ref_flag
+            @@xml_ref_flag = true
             @xml_refs << xml_ref
         end

         def assert_accessor(name)
-            @tag_accessors = [] unless @tag_accessors
+            @tag_accessors = [] unless @tag_accessors && @@tag_flag
+            @@tag_flag = true
             raise "Accessor #{name} is already defined as XML accessor in class #{self}" if @tag_accessors.include?(name)
             @tag_accessors << name
         end
@@ -444,6 +453,7 @@
         #
         def included(klass)
             super
+            ROXML_Class::setZero#initialize flag
             klass.__send__(:extend, ROXML_Class)
         end
     end
@@ -483,7 +493,7 @@
         #
         # Return an utf-8 representation of this string.
         #
-        def to_utf
+        def to_latin
             begin
                 Iconv.new("utf-8", "iso-8859-1").iconv(self)
             rescue Iconv::IllegalSequence => e
@@ -495,7 +505,7 @@
         #
         # Convert this string to iso-8850-1
         #
-        def to_latin
+        def to_utf
             begin
                 Iconv.new("iso-8859-1", "utf-8").iconv(self)
             rescue Iconv::IllegalSequence => e

 最後の「to_utf」と「to_latin」の関数名と中身が逆…orz。なるべく静観するつもりだったけど、これは早々に報告したほうがいいかも…。