1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/-test-/hash/delete.c

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
337 B
C
Raw Normal View History

#include "ruby.h"
extern VALUE rb_hash_delete_entry(VALUE hash, VALUE key);
static VALUE
hash_delete(VALUE hash, VALUE key)
{
VALUE ret = rb_hash_delete_entry(hash, key);
return ret == Qundef ? Qnil : rb_ary_new_from_values(1, &ret);
}
void
Init_delete(VALUE klass)
{
rb_define_method(klass, "delete!", hash_delete, 1);
}