Added common aliases for Ogg::Vorbis::Comments#has_key?.
[ruby-vorbistagger.git] / ext / comments.c
index bc7d844d0d10cf9829f7dd99f3fab4a4ac9912b2..b37f59146ea3067ff1902137cb554389f61731eb 100644 (file)
@@ -355,7 +355,7 @@ c_aset (VALUE self, VALUE key, VALUE value)
                }
        }
 
-       tmp = rb_ary_new3 (2, key, value);
+       tmp = rb_ary_new3 (2, rb_str_dup_frozen (key), value);
        OBJ_FREEZE (tmp);
 
        rb_ary_push (o->items, tmp);
@@ -551,6 +551,9 @@ Init_Comments (VALUE mVorbis)
 
        rb_define_alias (c, "size", "length");
        rb_define_alias (c, "each_pair", "each");
+       rb_define_alias (c, "key?", "has_key?");
+       rb_define_alias (c, "include?", "has_key?");
+       rb_define_alias (c, "member?", "has_key?");
 
        id_casecmp = rb_intern ("casecmp");
        id_replace = rb_intern ("replace");