vc = vcedit_comments (state);
- items = rb_ary_new2 (vc->comments);
- rb_iv_set (self, "items", items);
+ items = rb_iv_get (self, "items");
+ rb_ary_clear (items);
for (i = 0; i < vc->comments; i++) {
VALUE k, v, pair;
StringValuePtr (pair->ptr[1]));
}
}
+/*
+ * call-seq:
+ * Ogg::Vorbis::Comments.new -> object
+ *
+ * Creates an Ogg::Vorbis::Comments object.
+ */
+static VALUE
+c_init (VALUE self)
+{
+ rb_iv_set (self, "items", rb_ary_new ());
+
+ return self;
+}
/*
* call-seq:
c = rb_define_class_under (mVorbis, "Comments", rb_cObject);
+ rb_define_method (c, "initialize", c_init, 0);
rb_define_method (c, "inspect", c_inspect, 0);
rb_define_method (c, "clear", c_clear, 0);
rb_define_method (c, "delete", c_delete, 1);
ensure
FileUtils.rm_f("test/foo.bar")
end
+
+ def test_standalone_comments_object
+ o = Ogg::Vorbis::Comments.new
+ assert_equal(o.length, 0);
+ end
end