Method: DBM.open
- Defined in:
- dbm.c
.open(filename[, mode[, flags]]) ⇒ Object .open(filename[, mode[, flags]]) {|dbm| ... } ⇒ Object
Open a dbm database and yields it if a block is given. See also DBM.new.
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'dbm.c', line 228
static VALUE
fdbm_s_open(int argc, VALUE *argv, VALUE klass)
{
VALUE obj = Data_Wrap_Struct(klass, 0, free_dbm, 0);
if (NIL_P(fdbm_initialize(argc, argv, obj))) {
return Qnil;
}
if (rb_block_given_p()) {
return rb_ensure(rb_yield, obj, fdbm_close, obj);
}
return obj;
}
|