summaryrefslogtreecommitdiff
path: root/jni/ruby/ext/-test-/hash/delete.c
blob: 10d4aec6e74eff0d3f533f75b02ce07291e8598c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#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);
}