Class: Filedict::Set

Inherits:
Set
  • Object
show all
Defined in:
ext/filedictrb/hash.c

Instance Method Summary collapse

Instance Method Details

#add(*args) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'ext/filedictrb/hash.c', line 87

static VALUE fd_set_add(int argc, VALUE *argv, VALUE self) {
    VALUE fd_hash_ruby_object = rb_ivar_get(self, id_fd_hash);

    if (fd_hash_ruby_object == Qnil) {
        return rb_call_super(argc, argv);
    }

    fd_hash_t *fd_hash = RTYPEDDATA_DATA(fd_hash_ruby_object);
    int i;

    VALUE key = rb_ivar_get(self, id_fd_key);
    const char *key_cstr = StringValuePtr(key);
    const char *value_cstr;

    for (i = 0; i < argc; ++i) {
        value_cstr = StringValuePtr(argv[i]);
        filedict_insert_unique(&fd_hash->filedict, key_cstr, value_cstr);
    }

    return rb_call_super(argc, argv);
}