# class BDB::Delegate

### Public Class Methods

_load(p1) click to toggle source

    static VALUE
    bdb_deleg_load(VALUE obj, VALUE str)
    {
        bdb_DB *dbst;

        obj = bdb_local_aref();
        Data_Get_Struct(obj, bdb_DB, dbst);
        return rb_funcall(dbst->marshal, bdb_id_load, 1, str);
    }

_load_data(p1) click to toggle source

    static VALUE
    bdb_deleg_load(VALUE obj, VALUE str)
    {
        bdb_DB *dbst;

        obj = bdb_local_aref();
        Data_Get_Struct(obj, bdb_DB, dbst);
        return rb_funcall(dbst->marshal, bdb_id_load, 1, str);
    }

### Public Instance Methods

_dump(p1) click to toggle source

    static VALUE
    bdb_deleg_dump(VALUE obj, VALUE limit)
    {
        struct deleg_class *delegst;
        bdb_DB *dbst;
        Data_Get_Struct(obj, struct deleg_class, delegst);
        Data_Get_Struct(delegst->db, bdb_DB, dbst);
        return rb_funcall(dbst->marshal, bdb_id_dump, 1, delegst->obj);
    }

_dump_data(p1) click to toggle source

    static VALUE
    bdb_deleg_dump(VALUE obj, VALUE limit)
    {
        struct deleg_class *delegst;
        bdb_DB *dbst;
        Data_Get_Struct(obj, struct deleg_class, delegst);
        Data_Get_Struct(delegst->db, bdb_DB, dbst);
        return rb_funcall(dbst->marshal, bdb_id_dump, 1, delegst->obj);
    }

inspect() click to toggle source

    static VALUE bdb_deleg_inspect(VALUE obj)

method_missing(*args) click to toggle source

    static VALUE
    bdb_deleg_missing(int argc, VALUE *argv, VALUE obj)
    {
        struct deleg_class *delegst, *newst;
        bdb_DB *dbst;
        VALUE res, new;

        Data_Get_Struct(obj, struct deleg_class, delegst);
        if (rb_block_given_p()) {
    #if HAVE_RB_BLOCK_CALL
            res = rb_block_call(delegst->obj, id_send, argc, argv, rb_yield, 0);
    #else
            VALUE tmp[3];

            tmp[0] = delegst->obj;
            tmp[1] = (VALUE)argc;
            tmp[2] = (VALUE)argv;
            res = rb_iterate((VALUE(*)(VALUE))bdb_deleg_each, (VALUE)tmp, rb_yield, 0);
    #endif
        }
        else {
            res = rb_funcall2(delegst->obj, id_send, argc, argv);
        }
        Data_Get_Struct(delegst->db, bdb_DB, dbst);
        if (dbst->dbp) {
            VALUE nargv[2];

            if (!SPECIAL_CONST_P(res) &&
                (TYPE(res) != T_DATA ||
                 RDATA(res)->dmark != (RUBY_DATA_FUNC)bdb_deleg_mark)) {
                new = Data_Make_Struct(bdb_cDelegate, struct deleg_class,
                                       bdb_deleg_mark, free, newst);
                newst->db = delegst->db;
                newst->obj = res;
                newst->key = (!delegst->type)?obj:delegst->key;
                newst->type = 1;
                res = new;
            }
            if (!delegst->type) {
                nargv[0] = delegst->key;
                nargv[1] = delegst->obj;
            }
            else {
                Data_Get_Struct(delegst->key, struct deleg_class, newst);
                nargv[0] = newst->key;
                nargv[1] = newst->obj;
            }
            bdb_put(2, nargv, delegst->db);
        }
        return res;
    }

to_a() click to toggle source

    static VALUE bdb_deleg_to_a(VALUE obj)

to_ary() click to toggle source

    static VALUE bdb_deleg_to_ary(VALUE obj)

to_f() click to toggle source

    static VALUE bdb_deleg_to_f(VALUE obj)

to_hash() click to toggle source

    static VALUE bdb_deleg_to_hash(VALUE obj)

to_i() click to toggle source

    static VALUE bdb_deleg_to_i(VALUE obj)

to_int() click to toggle source

    static VALUE bdb_deleg_to_int(VALUE obj)

to_io() click to toggle source

    static VALUE bdb_deleg_to_io(VALUE obj)

to_orig() click to toggle source

    VALUE
    bdb_deleg_to_orig(VALUE obj)
    {
        struct deleg_class *delegst;
        Data_Get_Struct(obj, struct deleg_class, delegst);
        return delegst->obj;
    }

to_proc() click to toggle source

    static VALUE bdb_deleg_to_proc(VALUE obj)

to_s() click to toggle source

    static VALUE bdb_deleg_to_s(VALUE obj)

to_str() click to toggle source

    static VALUE bdb_deleg_to_str(VALUE obj)